jffs2_kill_sb(): deal with failed allocations
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 3 Apr 2018 03:56:44 +0000 (23:56 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 16 Apr 2018 03:49:05 +0000 (23:49 -0400)
jffs2_fill_super() might fail to allocate jffs2_sb_info;
jffs2_kill_sb() must survive that.

Cc: stable@kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/jffs2/super.c

index f60dee7..87bdf0f 100644 (file)
@@ -342,7 +342,7 @@ static void jffs2_put_super (struct super_block *sb)
 static void jffs2_kill_sb(struct super_block *sb)
 {
        struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
-       if (!sb_rdonly(sb))
+       if (c && !sb_rdonly(sb))
                jffs2_stop_garbage_collect_thread(c);
        kill_mtd_super(sb);
        kfree(c);