Skip to content

Commit f5f578e

Browse files
Hou Taogregkh
authored andcommitted
jffs2: free jffs2_sb_info through jffs2_kill_sb()
commit 92e2921 upstream. When an invalid mount option is passed to jffs2, jffs2_parse_options() will fail and jffs2_sb_info will be freed, but then jffs2_sb_info will be used (use-after-free) and freeed (double-free) in jffs2_kill_sb(). Fix it by removing the buggy invocation of kfree() when getting invalid mount options. Fixes: 92abc47 ("jffs2: implement mount option parsing and compression overriding") Cc: [email protected] Signed-off-by: Hou Tao <[email protected]> Reviewed-by: Richard Weinberger <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 43cba96 commit f5f578e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/jffs2/super.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,8 @@ static int jffs2_fill_super(struct super_block *sb, void *data, int silent)
285285
sb->s_fs_info = c;
286286

287287
ret = jffs2_parse_options(c, data);
288-
if (ret) {
289-
kfree(c);
288+
if (ret)
290289
return -EINVAL;
291-
}
292290

293291
/* Initialize JFFS2 superblock locks, the further initialization will
294292
* be done later */

0 commit comments

Comments
 (0)