summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorKaleb S KEITHLEY <kkeithle@redhat.com>2016-06-03 13:29:00 -0400
committerKaleb KEITHLEY <kkeithle@redhat.com>2016-06-08 05:15:20 -0700
commit8d99b1860dbaa62da3edb1ec9fd626f51f9d2c95 (patch)
treeaf00b62d9ac1e5eaed0ce1c823f32e000b97945b /glusterfsd
parent02e0bcca1967e174fd17d863c0dffd62ef27a847 (diff)
libglusterfs (timer): race conditions, illegal mem access, mem leak
While investigating gfapi memory consumption with valgrind, valgrind reported several memory access issues. Also see the timer 'registry' being recreated (shortly) after being freed during teardown due to the way it's currently written. Passing ctx as data to gf_timer_proc() is prone to memory access issues if ctx is freed before gf_timer_proc() terminates. (And in fact this does happen, at least in valgrind.) gf_timer_proc() doesn't need ctx for anything, it only needs ctx->timer, so just pass that. Nothing ever calls gf_timer_registry_init(). Nothing outside of timer.c that is. Making it and gf_timer_proc() static. backport mainline: > http://review.gluster.org/14247 > BUG: 1333925 Change-Id: Ia28454dda0cf0de2fec94d76441d98c3927a906a BUG: 1342620 Signed-off-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/14644 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 02fd72bc2c0..4a2f7ad5a7f 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1488,7 +1488,7 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)
if (!ctx->logbuf_pool)
goto out;
- pthread_mutex_init (&(ctx->lock), NULL);
+ LOCK_INIT (&ctx->lock);
pthread_mutex_init (&ctx->notify_lock, NULL);
pthread_cond_init (&ctx->notify_cond, NULL);