Patchwork jffs2: fix unbalanced locking

login
register
mail settings
Submitter Zefan Li
Date Sept. 23, 2013, 8:52 a.m.
Message ID <5240014E.1080804@huawei.com>
Download mbox | patch
Permalink /patch/277118/
State New
Headers show

Comments

Zefan Li - Sept. 23, 2013, 8:52 a.m.
In the failure path in jffs2_do_crccheck_inode() the lock isn't released
before returning.

This probably won't cause real bug, because the structure that contains
the lock is freed in this case.

Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 fs/jffs2/readinode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index ae81b01..55cf63d 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -1425,7 +1425,8 @@  int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *i
 		jffs2_do_clear_inode(c, f);
 	}
 	jffs2_xattr_do_crccheck_inode(c, ic);
-	kfree (f);
+	mutex_unlock(&f->sem);
+	kfree(f);
 	return ret;
 }