]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: fix KMSAN uninit-value in extent_info usage
authorAbinash Singh <abinashlalotra@gmail.com>
Wed, 25 Jun 2025 11:05:37 +0000 (16:35 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:05:06 +0000 (12:05 +0200)
commite68b751ec2b15d866967812c57cfdfc1eba6a269
treedd354f8837946d79753c1b87b68e8b0442278483
parent8c88fdaca871e29970c901ebb04face893ae4189
f2fs: fix KMSAN uninit-value in extent_info usage

[ Upstream commit 154467f4ad033473e5c903a03e7b9bca7df9a0fa ]

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.

Reported-by: syzbot+b8c1d60e95df65e827d4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b8c1d60e95df65e827d4
Fixes: 94afd6d6e525 ("f2fs: extent cache: support unaligned extent")
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Abinash Singh <abinashsinghlalotra@gmail.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/extent_cache.c