14f8ab
From ffd428d07036531b7ed98c7393b87490aaa223ec Mon Sep 17 00:00:00 2001
14f8ab
From: Niels de Vos <ndevos@redhat.com>
14f8ab
Date: Fri, 3 May 2019 09:18:31 +0200
14f8ab
Subject: [PATCH 437/449] glusterd: prevent use-after-free in
14f8ab
 glusterd_op_ac_send_brick_op()
14f8ab
14f8ab
Coverity reported that GF_FREE(req_ctx) could be called 2x on req_ctx.
14f8ab
14f8ab
> upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22656/
14f8ab
> Change-Id: I9120686e5920de8c27688e10de0db6aa26292064
14f8ab
> CID: 1401115
14f8ab
> Updates: bz#789278
14f8ab
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
14f8ab
14f8ab
BUG: 1787310
14f8ab
Change-Id: I9120686e5920de8c27688e10de0db6aa26292064
14f8ab
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/202619
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 xlators/mgmt/glusterd/src/glusterd-op-sm.c | 3 +--
14f8ab
 1 file changed, 1 insertion(+), 2 deletions(-)
14f8ab
14f8ab
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
index 46fc607..1e84f5f 100644
14f8ab
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
14f8ab
@@ -7575,7 +7575,6 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
14f8ab
             if (op_errstr == NULL)
14f8ab
                 gf_asprintf(&op_errstr, OPERRSTR_BUILD_PAYLOAD);
14f8ab
             opinfo.op_errstr = op_errstr;
14f8ab
-            GF_FREE(req_ctx);
14f8ab
             goto out;
14f8ab
         }
14f8ab
     }
14f8ab
@@ -7594,7 +7593,7 @@ glusterd_op_ac_send_brick_op(glusterd_op_sm_event_t *event, void *ctx)
14f8ab
     }
14f8ab
 
14f8ab
 out:
14f8ab
-    if (ret && req_ctx && free_req_ctx)
14f8ab
+    if (ret && free_req_ctx)
14f8ab
         GF_FREE(req_ctx);
14f8ab
     gf_msg_debug(this->name, 0, "Returning with %d", ret);
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab