9ae3f9
From a92b4f6373cb18544325436cf86abfebd6780d79 Mon Sep 17 00:00:00 2001
9ae3f9
From: Homma <homma@allworks.co.jp>
9ae3f9
Date: Fri, 5 Jul 2019 16:10:41 +0530
9ae3f9
Subject: [PATCH 409/449] system/posix-acl: update ctx only if iatt is non-NULL
9ae3f9
9ae3f9
We need to safe-guard against possible zero'ing out of iatt
9ae3f9
structure in acl ctx, which can cause many issues.
9ae3f9
9ae3f9
> upstream patch: https://review.gluster.org/#/c/glusterfs/+/23003/
9ae3f9
> fixes: 1668286
9ae3f9
> Change-Id: Ie81a57d7453a6624078de3be8c0845bf4d432773
9ae3f9
> Signed-off-by: Amar Tumballi <amarts@redhat.com>
9ae3f9
9ae3f9
BUG: 1781649
9ae3f9
Change-Id: I655b61551d30215b9f23cafc3ef9a5c0d98a43d0
9ae3f9
Signed-off-by: Raghavendra M <raghavendra@redhat.com>
9ae3f9
Reviewed-on: https://code.engineering.redhat.com/gerrit/202446
9ae3f9
Tested-by: RHGS Build Bot <nigelb@redhat.com>
9ae3f9
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
9ae3f9
---
9ae3f9
 xlators/system/posix-acl/src/posix-acl.c | 8 ++++++++
9ae3f9
 1 file changed, 8 insertions(+)
9ae3f9
9ae3f9
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
9ae3f9
index 38e48b8..c6ba281 100644
9ae3f9
--- a/xlators/system/posix-acl/src/posix-acl.c
9ae3f9
+++ b/xlators/system/posix-acl/src/posix-acl.c
9ae3f9
@@ -875,6 +875,13 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf,
9ae3f9
     int ret = 0;
9ae3f9
     int i = 0;
9ae3f9
 
9ae3f9
+    if (!buf || !buf->ia_ctime) {
9ae3f9
+        /* No need to update ctx if buf is empty */
9ae3f9
+        gf_log_callingfn(this->name, GF_LOG_DEBUG, "iatt struct is empty (%d)",
9ae3f9
+                         fop);
9ae3f9
+        goto out;
9ae3f9
+    }
9ae3f9
+
9ae3f9
     LOCK(&inode->lock);
9ae3f9
     {
9ae3f9
         ctx = __posix_acl_ctx_get(inode, this, _gf_true);
9ae3f9
@@ -928,6 +935,7 @@ posix_acl_ctx_update(inode_t *inode, xlator_t *this, struct iatt *buf,
9ae3f9
     }
9ae3f9
 unlock:
9ae3f9
     UNLOCK(&inode->lock);
9ae3f9
+out:
9ae3f9
     return ret;
9ae3f9
 }
9ae3f9
 
9ae3f9
-- 
9ae3f9
1.8.3.1
9ae3f9