From: Al Viro Date: Tue, 3 Apr 2018 03:56:44 +0000 (-0400) Subject: jffs2_kill_sb(): deal with failed allocations X-Git-Tag: v3.18.106~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e05f940f55a73ff835a0b6ee7d4dfbeaf9a7375;p=thirdparty%2Fkernel%2Fstable.git jffs2_kill_sb(): deal with failed allocations commit c66b23c2840446a82c389e4cb1a12eb2a71fa2e4 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 0918f0e2e2660..10902f70883d5 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c @@ -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);