diff options
author | Pavan Sondur <pavan@gluster.com> | 2009-09-29 11:03:54 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-01 03:32:19 -0700 |
commit | 572fb95127a37c3bf45a60083ad247064d634085 (patch) | |
tree | 620ab552db3211ae3c1fea970b827afb927274e7 | |
parent | 41c32c84892365c5230a5e61addc44dbfcd2e5cf (diff) |
Check if path is valid after call to inode_path before accessing it.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 287 (call to inode_path can result in a segfault)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=287
-rw-r--r-- | xlators/features/locks/src/inodelk.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c index c802d2d6e10..6ef8186e183 100644 --- a/xlators/features/locks/src/inodelk.c +++ b/xlators/features/locks/src/inodelk.c @@ -324,7 +324,11 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, __delete_inode_lock (l); - inode_path (inode, NULL, &path); + if (inode_path (inode, NULL, &path) < 0) { + gf_log (this->name, GF_LOG_TRACE, + "inode_path failed"); + goto unlock; + } gf_log (this->name, GF_LOG_TRACE, "releasing lock on %s held by " @@ -332,12 +336,12 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom, path, trans, (uint64_t) l->client_pid); - if (path) - FREE (path); - } } unlock: + if (path) + FREE (path); + pthread_mutex_unlock (&pinode->mutex); return 0; |