summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2015-07-11 15:47:18 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2015-07-12 06:40:52 -0700
commit8bb1a1c0cbfeabaf74bf18f7ddc0245733fb57cd (patch)
tree4397994b2585d07350e2ed066d5841a672be7981 /xlators
parentb99dc077873afe90411085006739d1c1832f083b (diff)
access_control : avoid double unrefing of acl variable in its context.
In handling_other_acl_related_xattr(), acl variable is unrefered twice after updating the context of access_control translator.So the acl variable stored in the inmemory context will become invalid one. When the variable accessed again , it will result in brick crash. This patch fixes the same. Backport of http://review.gluster.org/#/c/11632/ >Change-Id: Ib95d2e3d67b0fb20d201244a206379d6261aeb23 >BUG: 1242041 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: I5dc69d8ea8f3e4740a90a52cabf86e317950a659 BUG: 1242044 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11634 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index da2ccbd1c54..b1d3df396fb 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -1945,37 +1945,38 @@ handling_other_acl_related_xattr (xlator_t *this, inode_t *inode, dict_t *xattr)
data_t *data = NULL;
int ret = 0;
- ctx = posix_acl_ctx_get (inode, this);
- if (!ctx) {
- ret = -1;
- goto out;
- }
-
data = dict_get (xattr, POSIX_ACL_ACCESS_XATTR);
if (data) {
- ctx = posix_acl_ctx_get (inode, this);
- if (!ctx) {
+
+
+ acl = posix_acl_from_xattr (this, data->data, data->len);
+ if (!acl) {
ret = -1;
goto out;
}
- acl = posix_acl_from_xattr (this, data->data, data->len);
-
ret = posix_acl_set_specific (inode, this, acl, _gf_true);
if (ret)
goto out;
- if (acl)
- posix_acl_access_set_mode (acl, ctx);
-
- }
+ ctx = posix_acl_ctx_get (inode, this);
+ if (!ctx) {
+ ret = -1;
+ goto out;
+ }
- if (acl)
+ posix_acl_access_set_mode (acl, ctx);
posix_acl_unref (this, acl);
+ acl = NULL;
+ }
data = dict_get (xattr, POSIX_ACL_DEFAULT_XATTR);
if (data) {
acl = posix_acl_from_xattr (this, data->data, data->len);
+ if (!acl) {
+ ret = -1;
+ goto out;
+ }
ret = posix_acl_set_specific (inode, this, acl, _gf_false);
}