mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Abinash Singh <abinashlalotra@gmail.com>,
	linux-f2fs-devel@lists.sourceforge.net
Cc: chao@kernel.org, jaegeuk@kernel.org,
	linux-kernel@vger.kernel.org,
	Abinash Singh <abinashsinghlalotra@gmail.com>,
	syzbot+b8c1d60e95df65e827d4@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] f2fs: fix KMSAN uninit-value in extent_info usage
Date: Tue, 24 Jun 2025 22:16:05 +0800	[thread overview]
Message-ID: <1669c05c-7468-4347-a924-cfc4145c8c75@kernel.org> (raw)
In-Reply-To: <20250619120933.125932-1-abinashsinghlalotra@gmail.com>

On 2025/6/19 20:09, Abinash Singh wrote:
> KMSAN reported a use of uninitialized value in `__is_extent_mergeable()` and
> `__is_back_mergeable()` via the read extent tree path.
> 
> The root cause is that `get_read_extent_info()` only initializes three fields
> (`fofs`, `blk`, `len`) of `struct extent_info`, leaving the remaining fields
> uninitialized. This leads to undefined behavior when those fields are accessed
> later, especially during extent merging.
> 
> Fix it by zero-initializing the `extent_info` struct before population.
> 

It needs to add a fixes line, otherwise, it looks good to me.

Thanks,

> Reported-by: syzbot+b8c1d60e95df65e827d4@syzkaller.appspotmail.com
> Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
> 
> ---
> v2 : Corrected Author name
> ---
>   fs/f2fs/extent_cache.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c
> index cfe925a3d555..4ce19a310f38 100644
> --- a/fs/f2fs/extent_cache.c
> +++ b/fs/f2fs/extent_cache.c
> @@ -414,7 +414,7 @@ void f2fs_init_read_extent_tree(struct inode *inode, struct folio *ifolio)
>   	struct f2fs_extent *i_ext = &F2FS_INODE(&ifolio->page)->i_ext;
>   	struct extent_tree *et;
>   	struct extent_node *en;
> -	struct extent_info ei;
> +	struct extent_info ei = {0};
>   
>   	if (!__may_extent_tree(inode, EX_READ)) {
>   		/* drop largest read extent */


  reply	other threads:[~2025-06-24 14:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 12:09 Abinash Singh
2025-06-24 14:16 ` Chao Yu [this message]
2025-06-24 17:09   ` [PATCH v3] " Abinash Singh
2025-06-25  2:19     ` Chao Yu
2025-06-25 11:05       ` [PATCH v4] " Abinash Singh
2025-07-09 18:10         ` [f2fs-dev] " patchwork-bot+f2fs

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=1669c05c-7468-4347-a924-cfc4145c8c75@kernel.org \
    --to=chao@kernel.org \
    --cc=abinashlalotra@gmail.com \
    --cc=abinashsinghlalotra@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+b8c1d60e95df65e827d4@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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®