summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHumble Devassy Chirammal <hchiramm@redhat.com>2015-04-01 17:50:25 +0530
committerNiels de Vos <ndevos@redhat.com>2015-04-08 18:13:36 +0000
commit737c027edc51749ebe023baf4ec0db3077329988 (patch)
treeb6b0a2d2602dc760e1c353b3fc7362a38d9ef326
parentd3760ac3fe626378ef38c3626d642fe8cfd80ebb (diff)
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 <hchiramm@redhat.com> Reviewed-on: http://review.gluster.org/10102 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--libglusterfs/src/logging.c3
1 files changed, 3 insertions, 0 deletions
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);