From 737c027edc51749ebe023baf4ec0db3077329988 Mon Sep 17 00:00:00 2001 From: Humble Devassy Chirammal Date: Wed, 1 Apr 2015 17:50:25 +0530 Subject: libglusterfs: avoid possibility of crash when ctx is null ctx is passed to gf_log_inject_timer_event() and pass through to __gf_log_inject_timer_event() where the struct members are getting dereferenced, and can cause crash if the passed ctx is null. This patch avoids the issue. Change-Id: I153dbb5d3744898429139e3d40bb4f0e9093632a BUG: 1208118 Signed-off-by: Humble Devassy Chirammal Reviewed-on: http://review.gluster.org/10102 Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- libglusterfs/src/logging.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 078125088d6..3b0c1e8244c 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -1790,6 +1790,9 @@ gf_log_inject_timer_event (glusterfs_ctx_t *ctx) { int ret = -1; + if (!ctx) + return -1; + pthread_mutex_lock (&ctx->log.log_buf_lock); { ret = __gf_log_inject_timer_event (ctx); -- cgit