Skip to content

Commit 907c3fe

Browse files
Luis Henriques (SUSE)tytso
authored andcommitted
ext4: fix infinite loop when replaying fast_commit
When doing fast_commit replay an infinite loop may occur due to an uninitialized extent_status struct. ext4_ext_determine_insert_hole() does not detect the replay and calls ext4_es_find_extent_range(), which will return immediately without initializing the 'es' variable. Because 'es' contains garbage, an integer overflow may happen causing an infinite loop in this function, easily reproducible using fstest generic/039. This commit fixes this issue by unconditionally initializing the structure in function ext4_es_find_extent_range(). Thanks to Zhang Yi, for figuring out the real problem! Fixes: 8016e29 ("ext4: fast commit recovery path") Signed-off-by: Luis Henriques (SUSE) <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent b078553 commit 907c3fe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/ext4/extents_status.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ void ext4_es_find_extent_range(struct inode *inode,
310310
ext4_lblk_t lblk, ext4_lblk_t end,
311311
struct extent_status *es)
312312
{
313+
es->es_lblk = es->es_len = es->es_pblk = 0;
314+
313315
if (EXT4_SB(inode->i_sb)->s_mount_state & EXT4_FC_REPLAY)
314316
return;
315317

0 commit comments

Comments
 (0)