887953
From 10868bfc5ed099a90fbfd2310bc89c299475d94e Mon Sep 17 00:00:00 2001
887953
From: Mohit Agrawal <moagrawa@redhat.com>
887953
Date: Wed, 19 Dec 2018 13:08:01 +0530
887953
Subject: [PATCH 494/495] mem-pool: Resolve crash in mem_pool_destroy
887953
887953
Problem: In the commit c8e58e3a577e70a64df77fe885847285f682d9fb
887953
         change the code in mem_pool_destroy to delete pool->owner
887953
         without validate pool
887953
887953
Solution: To avoid the crash check the pool pointer
887953
887953
(gdb) f 0
887953
921	        LOCK (&pool->ctx->lock);
887953
(gdb) p pool
887953
$1 = (struct mem_pool *) 0x0
887953
887953
Change-Id: I34fdc8974c5c60767a5c26e7d1c9099d398b9722
887953
BUG: 1648893
887953
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
887953
Reviewed-on: https://code.engineering.redhat.com/gerrit/159029
887953
Tested-by: RHGS Build Bot <nigelb@redhat.com>
887953
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
887953
---
887953
 libglusterfs/src/mem-pool.c | 3 +++
887953
 1 file changed, 3 insertions(+)
887953
887953
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
887953
index d82a371..76daca9 100644
887953
--- a/libglusterfs/src/mem-pool.c
887953
+++ b/libglusterfs/src/mem-pool.c
887953
@@ -917,6 +917,9 @@ mem_put (void *ptr)
887953
 void
887953
 mem_pool_destroy (struct mem_pool *pool)
887953
 {
887953
+        if (!pool)
887953
+                return;
887953
+
887953
         /* remove this pool from the owner (glusterfs_ctx_t) */
887953
         LOCK (&pool->ctx->lock);
887953
         {
887953
-- 
887953
1.8.3.1
887953