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