From: Eric Biggers <ebiggers@kernel.org> To: linux-f2fs-devel@lists.sourceforge.net Cc: linux-fscrypt@vger.kernel.org, syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com Subject: [PATCH] f2fs: fix double free of f2fs_sb_info Date: Fri, 12 Jan 2024 16:57:47 -0800 [thread overview] Message-ID: <20240113005747.38887-1-ebiggers@kernel.org> (raw) In-Reply-To: <20240113005031.GA1147@sol.localdomain> From: Eric Biggers <ebiggers@google.com> 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: 275dca4630c1 ("f2fs: move release of block devices to after kill_block_super()") Reported-by: syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/0000000000006cb174060ec34502@google.com Signed-off-by: Eric Biggers <ebiggers@google.com> --- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d00d21a8b53ad..d45ab0992ae59 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4873,20 +4873,21 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) kfree(F2FS_OPTION(sbi).s_qf_names[i]); #endif fscrypt_free_dummy_policy(&F2FS_OPTION(sbi).dummy_enc_policy); kvfree(options); free_sb_buf: kfree(raw_super); free_sbi: if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); kfree(sbi); + sb->s_fs_info = NULL; /* give only one another chance */ if (retry_cnt > 0 && skip_recovery) { retry_cnt--; shrink_dcache_sb(sb); goto try_onemore; } return err; } base-commit: 38814330fedd778edffcabe0c8cb462ee365782e -- 2.43.0
WARNING: multiple messages have this Message-ID (diff)
From: Eric Biggers <ebiggers@kernel.org> To: linux-f2fs-devel@lists.sourceforge.net Cc: syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com, linux-fscrypt@vger.kernel.org Subject: [f2fs-dev] [PATCH] f2fs: fix double free of f2fs_sb_info Date: Fri, 12 Jan 2024 16:57:47 -0800 [thread overview] Message-ID: <20240113005747.38887-1-ebiggers@kernel.org> (raw) In-Reply-To: <20240113005031.GA1147@sol.localdomain> From: Eric Biggers <ebiggers@google.com> 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: 275dca4630c1 ("f2fs: move release of block devices to after kill_block_super()") Reported-by: syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com Closes: https://lore.kernel.org/r/0000000000006cb174060ec34502@google.com Signed-off-by: Eric Biggers <ebiggers@google.com> --- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d00d21a8b53ad..d45ab0992ae59 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4873,20 +4873,21 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) kfree(F2FS_OPTION(sbi).s_qf_names[i]); #endif fscrypt_free_dummy_policy(&F2FS_OPTION(sbi).dummy_enc_policy); kvfree(options); free_sb_buf: kfree(raw_super); free_sbi: if (sbi->s_chksum_driver) crypto_free_shash(sbi->s_chksum_driver); kfree(sbi); + sb->s_fs_info = NULL; /* give only one another chance */ if (retry_cnt > 0 && skip_recovery) { retry_cnt--; shrink_dcache_sb(sb); goto try_onemore; } return err; } base-commit: 38814330fedd778edffcabe0c8cb462ee365782e -- 2.43.0 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2024-01-13 0:58 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-12 17:48 [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super syzbot 2024-01-12 17:48 ` syzbot 2024-01-12 18:14 ` [f2fs-dev] " syzbot 2024-01-12 18:14 ` syzbot 2024-01-13 1:50 ` Hillf Danton 2024-01-13 2:14 ` syzbot 2024-01-13 0:32 ` syzbot 2024-01-13 0:32 ` [f2fs-dev] " syzbot 2024-01-13 0:50 ` Eric Biggers 2024-01-13 0:50 ` Eric Biggers 2024-01-13 0:57 ` Eric Biggers [this message] 2024-01-13 0:57 ` [f2fs-dev] [PATCH] f2fs: fix double free of f2fs_sb_info Eric Biggers 2024-01-13 1:01 ` Eric Biggers 2024-01-13 1:01 ` [f2fs-dev] " Eric Biggers 2024-01-13 1:28 ` Jaegeuk Kim 2024-01-13 1:28 ` Jaegeuk Kim 2024-01-13 1:32 ` Eric Biggers 2024-01-13 1:32 ` [f2fs-dev] " Eric Biggers 2024-01-13 1:46 ` Jaegeuk Kim 2024-01-13 1:46 ` [f2fs-dev] " Jaegeuk Kim 2024-01-13 1:14 ` Chao Yu 2024-01-13 1:14 ` Chao Yu 2024-01-13 6:38 ` [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in kill_f2fs_super syzbot 2024-01-13 6:38 ` syzbot 2024-01-18 3:59 ` Eric Biggers 2024-01-18 3:59 ` [f2fs-dev] " Eric Biggers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240113005747.38887-1-ebiggers@kernel.org \ --to=ebiggers@kernel.org \ --cc=linux-f2fs-devel@lists.sourceforge.net \ --cc=linux-fscrypt@vger.kernel.org \ --cc=syzbot+8f477ac014ff5b32d81f@syzkaller.appspotmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.