]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path"
authorRichard Weinberger <richard@nod.at>
Thu, 24 Oct 2019 08:25:35 +0000 (10:25 +0200)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 30 Jan 2020 15:25:17 +0000 (16:25 +0100)
BugLink: https://bugs.launchpad.net/bugs/1861085
commit 91cbf01178c37086b32148c53e24b04cb77557cf upstream.

This reverts commit 9163e0184bd7d5f779934d34581843f699ad2ffd.

At the point when ubifs_fill_super() runs, we have already a reference
to the super block. So upon deactivate_locked_super() c will get
free()'ed via ->kill_sb().

Cc: Wenwen Wang <wenwen@cs.uga.edu>
Fixes: 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")
Reported-by: https://twitter.com/grsecurity/status/1180609139359277056
Signed-off-by: Richard Weinberger <richard@nod.at>
Tested-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/ubifs/super.c

index 7d4547e5202de4c26b08623f8a229aba999fb0db..5e1e8ec0589eba84dd44b41a4b998df359b4e520 100644 (file)
@@ -2267,10 +2267,8 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
                }
        } else {
                err = ubifs_fill_super(sb, data, flags & SB_SILENT ? 1 : 0);
-               if (err) {
-                       kfree(c);
+               if (err)
                        goto out_deact;
-               }
                /* We do not support atime */
                sb->s_flags |= SB_ACTIVE;
                if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))