summaryrefslogtreecommitdiffstats
path: root/xlators/system
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 03:57:15 -0700
commit7f21238bb918a9b6eefcff5d76516a92a9271ae2 (patch)
treeb9b2b1b2139830f8f55ee6785166e95c344c7abe /xlators/system
parent160e539e26ed1e17a0c2cad97dd28cc8cbce9d6d (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. Change-Id: Ib95d2e3d67b0fb20d201244a206379d6261aeb23 BUG: 1242041 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11632 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/system')
-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);
}