Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path"
Subsystems (3)
Richard Weinberger
maintainerPATCH 1/1 Revert "ubifs: Fix memory leak bug in alloc_ubifs_info() error path"
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 <[email protected]>
Fixes 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")
Signed-off-by Richard Weinberger <[email protected]>
--- fs/ubifs/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ubifs/super.c +1 -3
@@ -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 ))
Signature · 1 line
2.16.4
Quoted 5 lines · Richard Weinberger
This reverts commit
9163e0184bd7d5f779934d34581843f699ad2ffd.At the point when
ubifs_fill_super()runs, we have already a reference to the super block. So upondeactivate_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.
Quoted 5 lines
Cc Wenwen Wang <[email protected]>Fixes 9163e0184bd7 ("ubifs: Fix memory leak bug in alloc_ubifs_info() error path")Signed-off-by Richard Weinberger <[email protected]>
Tested-by Romain Izard <[email protected]>
Quoted 23 lines
--- fs/ubifs/super.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/ubifs/super.c +1
-3@@ -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 ))Signature · 1 line
2.16.4