From 11343b3f8492f2366c57a869d04fdb5aeeed7483 Mon Sep 17 00:00:00 2001 From: Homma Date: Fri, 5 Jul 2019 16:10:41 +0530 Subject: system/posix-acl: update ctx only if iatt is non-NULL We need to safe-guard against possible zero'ing out of iatt structure in acl ctx, which can cause many issues. > fixes: bz#1668286 > Change-Id: Ie81a57d7453a6624078de3be8c0845bf4d432773 > Signed-off-by: Amar Tumballi > (cherry picked from commit 6bf9637a93011298d032332ca93009ba4e377e46) fixes: bz#1785493 Change-Id: Ie81a57d7453a6624078de3be8c0845bf4d432773 Signed-off-by: Mohit Agrawal --- xlators/system/posix-acl/src/posix-acl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index cd8d5e53aa1..77c8df5a54f 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -873,6 +873,13 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf, int ret = 0; int i = 0; + if (!buf || !buf->ia_ctime) { + /* No need to update ctx if buf is empty */ + gf_log_callingfn(this->name, GF_LOG_DEBUG, "iatt struct is empty (%d)", + fop); + goto out; + } + LOCK(&inode->lock); { ctx = __posix_acl_ctx_get(inode, this, _gf_true); @@ -926,6 +933,7 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf, } unlock: UNLOCK(&inode->lock); +out: return ret; } -- cgit