7f4c2a
From 09643c44a83dc0bba80286b3a7b460e419d3d79a Mon Sep 17 00:00:00 2001
7f4c2a
From: Raghavendra G <rgowdapp@redhat.com>
7f4c2a
Date: Mon, 6 Jul 2015 15:45:45 +0530
7f4c2a
Subject: [PATCH 207/212] protocol/server: Add null check to gf_client_put
7f4c2a
7f4c2a
Change-Id: I8bab3cd7387f89743e15e7569f0bc83a7df3c754
7f4c2a
BUG: 1239280
7f4c2a
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
7f4c2a
Reviewed-on: http://review.gluster.org/11550
7f4c2a
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
7f4c2a
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/52470
7f4c2a
---
7f4c2a
 libglusterfs/src/client_t.c                    |    6 ++++++
7f4c2a
 xlators/protocol/server/src/server-handshake.c |    2 +-
7f4c2a
 2 files changed, 7 insertions(+), 1 deletions(-)
7f4c2a
7f4c2a
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c
7f4c2a
index 035658f..c6997c0 100644
7f4c2a
--- a/libglusterfs/src/client_t.c
7f4c2a
+++ b/libglusterfs/src/client_t.c
7f4c2a
@@ -293,6 +293,9 @@ gf_client_put (client_t *client, gf_boolean_t *detached)
7f4c2a
         gf_boolean_t unref = _gf_false;
7f4c2a
         int bind_ref;
7f4c2a
 
7f4c2a
+        if (client == NULL)
7f4c2a
+                goto out;
7f4c2a
+
7f4c2a
         if (detached)
7f4c2a
                 *detached = _gf_false;
7f4c2a
 
7f4c2a
@@ -309,6 +312,9 @@ gf_client_put (client_t *client, gf_boolean_t *detached)
7f4c2a
                         *detached = _gf_true;
7f4c2a
                 gf_client_unref (client);
7f4c2a
         }
7f4c2a
+
7f4c2a
+out:
7f4c2a
+        return;
7f4c2a
 }
7f4c2a
 
7f4c2a
 client_t *
7f4c2a
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
7f4c2a
index 4aaa933..89e0c1a 100644
7f4c2a
--- a/xlators/protocol/server/src/server-handshake.c
7f4c2a
+++ b/xlators/protocol/server/src/server-handshake.c
7f4c2a
@@ -705,7 +705,7 @@ fail:
7f4c2a
          * list of connections the server is maintaining and might segfault
7f4c2a
          * during statedump when bound_xl of the connection is accessed.
7f4c2a
          */
7f4c2a
-        if (op_ret && !xl) {
7f4c2a
+        if (op_ret && !xl && (client != NULL)) {
7f4c2a
                 /* We would have set the xl_private of the transport to the
7f4c2a
                  * @conn. But if we have put the connection i.e shutting down
7f4c2a
                  * the connection, then we should set xl_private to NULL as it
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a