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