glusterfs/0325-core-dereference-check-on-the-variables-in-glusterfs.patch
Milind Changire 0820681560 autobuild v3.12.2-14
Resolves: bz#1547903 bz#1566336 bz#1568896 bz#1578716 bz#1581047
Resolves: bz#1581231 bz#1582066 bz#1593865 bz#1597506 bz#1597511
Resolves: bz#1597654 bz#1597768 bz#1598105 bz#1598356 bz#1599037
Resolves: bz#1599823 bz#1600057 bz#1601314
Signed-off-by: Milind Changire <mchangir@redhat.com>
2018-07-18 08:38:52 -04:00

64 lines
2.2 KiB
Diff

From 6869ad72b95983975675a4b920df8fea1edcfca4 Mon Sep 17 00:00:00 2001
From: Hari Gowtham <hgowtham@redhat.com>
Date: Thu, 12 Jul 2018 14:02:03 +0530
Subject: [PATCH 325/325] core: dereference check on the variables in
glusterfs_handle_brick_status
back-port of:https://review.gluster.org/#/c/20498/
problem: In a race condition, the active->first which is supposed to be filled
is NULL and trying to dereference it crashs.
back trace:
Core was generated by `/usr/sbin/glusterfsd -s bxts470192.eu.rabonet.com --volfile-id prod_xvavol.bxts'.
Program terminated with signal 11, Segmentation fault.
1029 any = active->first;
(gdb) bt
>Change-Id: Ia6291865319a9456b8b01a5251be2679c4985b7c
>fixes: bz#1600451
>Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
Change-Id: Ia6291865319a9456b8b01a5251be2679c4985b7c
BUG: 1600057
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/144258
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
glusterfsd/src/glusterfsd-mgmt.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 2167241..30a717f 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1150,8 +1150,23 @@ glusterfs_handle_brick_status (rpcsvc_request_t *req)
}
ctx = glusterfsd_ctx;
- GF_ASSERT (ctx);
+ if (ctx == NULL) {
+ gf_log (this->name, GF_LOG_ERROR, "ctx returned NULL");
+ ret = -1;
+ goto out;
+ }
+ if (ctx->active == NULL) {
+ gf_log (this->name, GF_LOG_ERROR, "ctx->active returned NULL");
+ ret = -1;
+ goto out;
+ }
active = ctx->active;
+ if (ctx->active->first == NULL) {
+ gf_log (this->name, GF_LOG_ERROR, "ctx->active->first "
+ "returned NULL");
+ ret = -1;
+ goto out;
+ }
server_xl = active->first;
brick_xl = get_xlator_by_name (server_xl, brickname);
--
1.8.3.1