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