Skip to content

Commit c919330

Browse files
committed
f2fs: fix double free of f2fs_sb_info
kill_f2fs_super() is called even if f2fs_fill_super() fails. f2fs_fill_super() frees the struct f2fs_sb_info, so it must set sb->s_fs_info to NULL to prevent it from being freed again. Fixes: 275dca4 ("f2fs: move release of block devices to after kill_block_super()") Reported-by: <syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com> Closes: https://lore.kernel.org/lkml/0000000000006cb174060ec34502@google.com Reviewed-by: Chao Yu <chao@kernel.org> Link: https://lore.kernel.org/linux-f2fs-devel/20240113005747.38887-1-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com>
1 parent 3881433 commit c919330

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/f2fs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,6 +4880,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
48804880
if (sbi->s_chksum_driver)
48814881
crypto_free_shash(sbi->s_chksum_driver);
48824882
kfree(sbi);
4883+
sb->s_fs_info = NULL;
48834884

48844885
/* give only one another chance */
48854886
if (retry_cnt > 0 && skip_recovery) {

0 commit comments

Comments
 (0)