Skip to content

Commit 01b6f59

Browse files
AbinashLalotragregkh
authored andcommitted
f2fs: fix KMSAN uninit-value in extent_info usage
[ Upstream commit 154467f ] 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: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=b8c1d60e95df65e827d4 Fixes: 94afd6d ("f2fs: extent cache: support unaligned extent") Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Abinash Singh <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8fae5b6 commit 01b6f59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/f2fs/extent_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ void f2fs_init_read_extent_tree(struct inode *inode, struct folio *ifolio)
414414
struct f2fs_extent *i_ext = &F2FS_INODE(&ifolio->page)->i_ext;
415415
struct extent_tree *et;
416416
struct extent_node *en;
417-
struct extent_info ei;
417+
struct extent_info ei = {0};
418418

419419
if (!__may_extent_tree(inode, EX_READ)) {
420420
/* drop largest read extent */

0 commit comments

Comments
 (0)