summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-10-07 03:20:59 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-10-08 04:29:00 -0700
commit98e1ea0f178bdb8d26037edda9aae7bc2339bac4 (patch)
treec560211236cbc90f37a2682c5ff7da6285ae0744
parentd4b0360c8c4c5dab692f827972ccea0e728af688 (diff)
Possible race condition between cleanup and dereferencing
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1760 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1760
-rw-r--r--xlators/cluster/stripe/src/stripe.c1
-rw-r--r--xlators/debug/io-stats/src/io-stats.c4
-rw-r--r--xlators/encryption/rot-13/src/rot-13.c3
-rw-r--r--xlators/features/locks/src/posix.c3
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c3
-rw-r--r--xlators/performance/write-behind/src/write-behind.c3
-rw-r--r--xlators/protocol/legacy/transport/socket/src/socket.c3
-rw-r--r--xlators/storage/posix/src/posix.c3
8 files changed, 22 insertions, 1 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index a8ac55aa4..d37f38ca6 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -3941,6 +3941,7 @@ fini (xlator_t *this)
priv = this->private;
if (priv) {
+ this->private = NULL;
if (priv->xl_array)
GF_FREE (priv->xl_array);
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index e87334364..2061d9bc9 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1695,6 +1695,10 @@ fini (xlator_t *this)
conf = this->private;
+ if (!conf)
+ return;
+ this->private = NULL;
+
GF_FREE(conf);
gf_log (this->name, GF_LOG_NORMAL,
diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c
index 98bfd1b5a..39549d8be 100644
--- a/xlators/encryption/rot-13/src/rot-13.c
+++ b/xlators/encryption/rot-13/src/rot-13.c
@@ -181,6 +181,9 @@ fini (xlator_t *this)
{
rot_13_private_t *priv = this->private;
+ if (!priv)
+ return;
+ this->private = NULL;
GF_FREE (priv);
return;
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 36c399c11..29b3bb079 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1885,6 +1885,9 @@ fini (xlator_t *this)
posix_locks_private_t *priv = NULL;
priv = this->private;
+ if (!priv)
+ return 0;
+ this->private = NULL;
GF_FREE (priv);
return 0;
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;
}
diff --git a/xlators/protocol/legacy/transport/socket/src/socket.c b/xlators/protocol/legacy/transport/socket/src/socket.c
index 7b68e3a3e..854529ca2 100644
--- a/xlators/protocol/legacy/transport/socket/src/socket.c
+++ b/xlators/protocol/legacy/transport/socket/src/socket.c
@@ -1547,6 +1547,9 @@ fini (transport_t *this)
{
socket_private_t *priv = this->private;
+ if (!priv)
+ return;
+ this->private = NULL;
gf_log (this->xl->name, GF_LOG_TRACE,
"transport %p destroyed", this);
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index ef5dae218..51e4230ae 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -4438,6 +4438,9 @@ void
fini (xlator_t *this)
{
struct posix_private *priv = this->private;
+ if (!priv)
+ return;
+ this->private = NULL;
sys_lremovexattr (priv->base_path, "trusted.glusterfs.test");
GF_FREE (priv);
return;