From 98e1ea0f178bdb8d26037edda9aae7bc2339bac4 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 7 Oct 2010 03:20:59 +0000 Subject: Possible race condition between cleanup and dereferencing Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 1760 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1760 --- xlators/performance/stat-prefetch/src/stat-prefetch.c | 3 ++- xlators/performance/write-behind/src/write-behind.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'xlators/performance') diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index 972afe313..0a984908f 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -777,7 +777,7 @@ sp_cache_add_entries (sp_cache_t *cache, gf_dirent_t *entries) sp_private_t *priv = NULL; this = cache->this; - if (this) + if (this && this->private) priv = this->private; LOCK (&cache->lock); @@ -3676,6 +3676,7 @@ fini (xlator_t *this) mem_pool_destroy (priv->mem_pool); LOCK_DESTROY (&priv->lock); GF_FREE (priv); + this->private = NULL; } } out: diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 8a4be0f7f..42fc0bb7e 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -3009,6 +3009,9 @@ fini (xlator_t *this) { wb_conf_t *conf = this->private; + if (!conf) + return; + this->private = NULL; GF_FREE (conf); return; } -- cgit