From 572fb95127a37c3bf45a60083ad247064d634085 Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Tue, 29 Sep 2009 11:03:54 +0000 Subject: Check if path is valid after call to inode_path before accessing it. Signed-off-by: Anand V. Avati BUG: 287 (call to inode_path can result in a segfault) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=287 --- xlators/features/locks/src/inodelk.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'xlators') 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; -- cgit