]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
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)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:35 +0000 (21:36 -0400)
[ Upstream commit c66b23c2840446a82c389e4cb1a12eb2a71fa2e4 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
fs/jffs2/super.c

index d86c5e3176a133cd898a62ff8a587010da845385..600da1a4df2977657faa739294ecf00689d94439 100644 (file)
@@ -345,7 +345,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->s_flags & MS_RDONLY))
+       if (c && !(sb->s_flags & MS_RDONLY))
                jffs2_stop_garbage_collect_thread(c);
        kill_mtd_super(sb);
        kfree(c);