3604df
From fc1a2372e14adf41b810fc3e83bf8719369bdb41 Mon Sep 17 00:00:00 2001
3604df
From: Rajesh Joseph <rjoseph@redhat.com>
3604df
Date: Thu, 3 Nov 2016 14:21:28 +0530
3604df
Subject: [PATCH 157/157] posix-acl: check dictionary before using it
3604df
3604df
If extended attributes are not present in md-cache it returns NULL as xattr.
3604df
posix acl xlator should check for NULL before using xattr.
3604df
3604df
If normal and default ACLs are not set on file then md-cache will not contain
3604df
system.posix_acl_access and system.posix_acl_default extended attributes in
3604df
its cache.
3604df
3604df
Therefore posix_acl_lookup_cbk should check xattr before using it, otherwise
3604df
the logs will get filled with dictionary errors.
3604df
3604df
Change-Id: Icebf73cf0b313bd3e82ca8cbda63786dd0fa47da
3604df
BUG: 1386366
3604df
Signed-off-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
Reviewed-on: http://review.gluster.org/15769
3604df
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
3604df
Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
3604df
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
3604df
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/89419
3604df
Reviewed-by: Jiffin Thottan <jthottan@redhat.com>
3604df
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
3604df
---
3604df
 xlators/system/posix-acl/src/posix-acl.c |    3 +++
3604df
 1 files changed, 3 insertions(+), 0 deletions(-)
3604df
3604df
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
3604df
index f3666ef..8a21202 100644
3604df
--- a/xlators/system/posix-acl/src/posix-acl.c
3604df
+++ b/xlators/system/posix-acl/src/posix-acl.c
3604df
@@ -876,6 +876,9 @@ posix_acl_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
3604df
 
3604df
         ret = posix_acl_get (inode, this, &old_access, &old_default);
3604df
 
3604df
+        if (xattr == NULL)
3604df
+                goto acl_set;
3604df
+
3604df
         data = dict_get (xattr, POSIX_ACL_ACCESS_XATTR);
3604df
         if (!data)
3604df
                 goto acl_default;
3604df
-- 
3604df
1.7.1
3604df