]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 6 Jun 2018 15:49:49 +0000 (11:49 -0400)
BugLink: http://bugs.launchpad.net/bugs/1773233
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 <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Khalid Elmously <khalid.elmously@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/jffs2/super.c

index f60dee7faf0373f12bdfcf7f3d5f3883ec86b16e..87bdf0f4cba117fc7c987080b9b901d7614ebfd3 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);