summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2012-03-08 16:11:58 -0500
committerVijay Bellur <vijay@gluster.com>2012-03-14 02:17:13 -0700
commitfcb5ebde1e84da871a7f43df9ecbce7d1d1de435 (patch)
tree8a4fc5f990475ad95b0edbea1f2253946af691ca
parent61a550b77b776145d45025467f3fa6e9040bc2e0 (diff)
system/posix-acl: fix reference counting in posix_acl_readdirp_cbk
unref. the acl pointers from posix_acl_get() Change-Id: I1247f64ceded17bfa204d1b899ec56a27bef0cdb Signed-off-by: Brian Foster <bfoster@redhat.com> BUG: 801183 Reviewed-on: http://review.gluster.com/2904 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 0e92cb35f..0fe47c71d 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -1450,12 +1450,14 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (acl_access &&
posix_acl_matches_xattr (this, acl_access, data->data,
- data->len)) {
- acl_access = posix_acl_ref (this, acl_access);
- } else {
- acl_access = posix_acl_from_xattr (this, data->data,
- data->len);
- }
+ data->len))
+ goto acl_default;
+
+ if (acl_access)
+ posix_acl_unref(this, acl_access);
+
+ acl_access = posix_acl_from_xattr (this, data->data,
+ data->len);
acl_default:
data = dict_get (entry->dict, POSIX_ACL_DEFAULT_XATTR);
@@ -1464,12 +1466,14 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (acl_default &&
posix_acl_matches_xattr (this, acl_default, data->data,
- data->len)) {
- acl_default = posix_acl_ref (this, acl_default);
- } else {
- acl_default = posix_acl_from_xattr (this, data->data,
- data->len);
- }
+ data->len))
+ goto acl_set;
+
+ if (acl_default)
+ posix_acl_unref(this, acl_default);
+
+ acl_default = posix_acl_from_xattr (this, data->data,
+ data->len);
acl_set:
posix_acl_ctx_update (entry->inode, this, &entry->d_stat);
@@ -1479,6 +1483,11 @@ posix_acl_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (ret)
gf_log (this->name, GF_LOG_WARNING,
"failed to set ACL in context");
+
+ if (acl_access)
+ posix_acl_unref(this, acl_access);
+ if (acl_default)
+ posix_acl_unref(this, acl_default);
}
unwind: