From d339f87a6fadf7bc4d680a657ddc404247e14c47 Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Sun, 12 Aug 2018 18:02:17 -0700 Subject: 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 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit