[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191115132052.GA9185@5WDYG62>
Date: Fri, 15 Nov 2019 14:21:26 +0100
From: Romain Izard <romain.izard.pro@...il.com>
To: Richard Weinberger <richard@....at>
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Wenwen Wang <wenwen@...uga.edu>
Subject: Re: [PATCH] Revert "ubifs: Fix memory leak bug in alloc_ubifs_info()
error path"
On Thu, Oct 24, 2019 at 10:25:35AM +0200, Richard Weinberger wrote:
> 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().
And without a revert, trying to mount a UBI volume with a squashfs image
on it as a UBIFS partition will lead to kernel panics due to the double
free.
>
> Cc: Wenwen Wang <wenwen@...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@....at>
Tested-by: Romain Izard <romain.izard.pro@...il.com>
> ---
> fs/ubifs/super.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 7d4547e5202d..5e1e8ec0589e 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -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))
> --
> 2.16.4
>
Powered by blists - more mailing lists