From 79cbf27b9b98d1feebcc2f1db5fc1c976d2c24cf Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Fri, 3 Jan 2014 13:36:40 +0530 Subject: Glusterd : glusterd process generates core due to NULL store handle Problem : glusterd crashed as backtrace revealed that store handle was set to NULL. Solution : In glusterd_store_global_info() function out block the handle is dereferenced with out any NULL check which caused this segmentation fault. A NULL check is introduced to avoid this. While testing this fix, another issue was noticed where GF_ASSERT macro again does not gurantee the NULL dereference check and hence this macro call has been replaced by GF_VALIDATE_OR_GOTO macro call in places where there is a danger of macro getting crashed due to NULL dereference check. Change-Id: Ic301aa45ce4bbdc2da751d2386439df7bb24c016 BUG: 1040844 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/6619 Reviewed-by: Niels de Vos Reviewed-by: Krishnan Parthasarathi Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-store.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 3a4b090096b..d0ad7dcdb8d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -1329,12 +1329,14 @@ glusterd_store_global_info (xlator_t *this) ret = gf_store_rename_tmppath (handle); out: - if (ret && (handle->fd > 0)) - gf_store_unlink_tmppath (handle); + if (handle) { + if (ret && (handle->fd > 0)) + gf_store_unlink_tmppath (handle); - if (handle->fd > 0) { - close (handle->fd); - handle->fd = 0; + if (handle->fd > 0) { + close (handle->fd); + handle->fd = 0; + } } if (uuid_str) -- cgit