jffs2: unlock f->sem on error in jffs2_new_inode()
authorWang Guoli <andy.wangguoli@huawei.com>
Wed, 12 Feb 2014 20:44:54 +0000 (12:44 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 11 Mar 2014 05:42:28 +0000 (22:42 -0700)
commit01887a3a2353f1c2fc7488b871d6df8055acb109
tree77e1565fb98aac1f717cc2ef86638d340a0ea382
parent13b546d96207c131eeae15dc7b26c6e7d0f1cad7
jffs2: unlock f->sem on error in jffs2_new_inode()

If jffs2_new_inode() succeeds, it returns with f->sem held, and the caller
is responsible for releasing the lock.  If it fails, it still returns with
the lock held, but the caller won't release the lock, which will lead to
deadlock.

Fix it by releasing the lock in jffs2_new_inode() on error.

Signed-off-by: Wang Guoli <andy.wangguoli@huawei.com>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Wang Guoli <andy.wangguoli@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
[Brian: not marked for stable; no one observed deadlock, and I don't
        think it can happen here]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
fs/jffs2/fs.c