ocfs2: fix mutex_unlock and possible memory leak in ocfs2_remove_btree_range
authorJoseph Qi <joseph.qi@huawei.com>
Wed, 3 Jul 2013 22:00:52 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:23 +0000 (16:07 -0700)
commit33add0e3a09a62c7796ea9838243c1cd933d8543
treeb3f8df10c52c784f5e3b68639b4507e54f3d31ac
parent8fa9d17f93ee8eb79d595c98cef0944f6ee5de75
ocfs2: fix mutex_unlock and possible memory leak in ocfs2_remove_btree_range

In ocfs2_remove_btree_range, when calling ocfs2_lock_refcount_tree and
ocfs2_prepare_refcount_change_for_del failed, it goes to out and then
tries to call mutex_unlock without mutex_lock before.  And when calling
ocfs2_reserve_blocks_for_rec_trunc failed, it should free ref_tree
before return.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/alloc.c