summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2018-08-12 18:02:17 -0700
committerAtin Mukherjee <amukherj@redhat.com>2018-08-14 15:06:40 +0000
commitd339f87a6fadf7bc4d680a657ddc404247e14c47 (patch)
tree46f4121cad1b5986a5cf86f8a5ec128039344927 /xlators/mgmt
parent2189dedb565c6e36740b0168e57337636e25ef36 (diff)
mgmt/glusterd: Fix possible use after free in glusterd_op_ac_commit_op()
Fixes CID 1391418 Change-Id: I60ce6cd3b2528369f4dc1be81c0c15a1a806982a updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
index df341c3a3db..a7f00296906 100644
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
@@ -5985,6 +5985,7 @@ glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
xlator_t *this = NULL;
uuid_t *txn_id = NULL;
glusterd_op_info_t txn_op_info = {{0},};
+ gf_boolean_t need_cleanup = _gf_true;
this = THIS;
GF_ASSERT (this);
@@ -6041,6 +6042,7 @@ glusterd_op_ac_commit_op (glusterd_op_sm_event_t *event, void *ctx)
"Failed to set transaction id.");
if (txn_op_info.skip_locking)
ret = glusterd_clear_txn_opinfo (txn_id);
+ need_cleanup = _gf_false;
GF_FREE (txn_id);
goto out;
}
@@ -6057,7 +6059,7 @@ out:
/* for no volname transactions, the txn_opinfo needs to be cleaned up
* as there's no unlock event triggered
*/
- if (txn_id && txn_op_info.skip_locking)
+ if (need_cleanup && txn_id && txn_op_info.skip_locking)
ret = glusterd_clear_txn_opinfo (txn_id);
gf_msg_debug (this->name, 0, "Returning with %d", ret);