summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHomma <homma@allworks.co.jp>2019-07-05 16:10:41 +0530
committerAmar Tumballi <amarts@gmail.com>2019-10-15 05:42:30 +0000
commitcc853e02ea42ab1b86d94f7ed83574c3e07bcb0c (patch)
tree69162f3cad7de83b16eedf9bc2b259133505807b
parentcb848d75523ec81ec1a5ca581b540f8799761233 (diff)
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 <amarts@redhat.com> > (cherry picked from commit 6bf9637a93011298d032332ca93009ba4e377e46) Change-Id: I992d25f1c1282d50aa0232d01586d2df2216551c fixes: bz#1741402 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 38e48b8..c6ba281 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -875,6 +875,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);
@@ -928,6 +935,7 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf,
}
unlock:
UNLOCK(&inode->lock);
+out:
return ret;
}