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