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