summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhari gowtham <hgowtham@redhat.com>2018-05-08 11:42:33 +0530
committerRaghavendra G <rgowdapp@redhat.com>2018-05-11 10:54:48 +0000
commit1ef9270c0990e93712c211516ccc47c3bb27674b (patch)
tree4a63acedffec41048055b3592192722e0a54aac6
parent021b60858c562cd51dbeec8c00a61243c7189df2 (diff)
Glusterfsd: brick crash during get-state
The xprt's dereferencing wasn't checked before using it for the strcmp, which caused the segfault and crashed the brick process. fix: Check every deferenced variable before using it. Change-Id: I7f705d1c88a124e8219bb877156fadb17ecf11c3 fixes: bz#1575864 Signed-off-by: hari gowtham <hgowtham@redhat.com>
-rw-r--r--xlators/protocol/server/src/server.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index eef956cc21a..294b0de34e4 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -187,8 +187,11 @@ server_priv_to_dict (xlator_t *this, dict_t *dict, char *brickname)
pthread_mutex_lock (&conf->mutex);
{
list_for_each_entry (xprt, &conf->xprt_list, list) {
- if (!strcmp (brickname,
- xprt->xl_private->bound_xl->name)) {
+ if ((xprt) && (xprt->xl_private) &&
+ (xprt->xl_private->bound_xl) &&
+ (xprt->xl_private->bound_xl->name) && (brickname) &&
+ (!strcmp (brickname,
+ xprt->xl_private->bound_xl->name))) {
peerinfo = &xprt->peerinfo;
memset (key, 0, sizeof (key));
snprintf (key, sizeof (key),