Skip to content

Commit 45b7094

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: add sanity check on ei.len in __update_extent_tree_range()
Add a sanity check in __update_extent_tree_range() to detect any zero-sized extent update. Signed-off-by: wangzijie <[email protected]> Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 23361bd commit 45b7094

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/f2fs/extent_cache.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,15 @@ static void __update_extent_tree_range(struct inode *inode,
670670
if (!et)
671671
return;
672672

673+
if (unlikely(len == 0)) {
674+
f2fs_err_ratelimited(sbi, "%s: extent len is zero, type: %d, "
675+
"extent [%u, %u, %u], age [%llu, %llu]",
676+
__func__, type, tei->fofs, tei->blk, tei->len,
677+
tei->age, tei->last_blocks);
678+
f2fs_bug_on(sbi, 1);
679+
return;
680+
}
681+
673682
if (type == EX_READ)
674683
trace_f2fs_update_read_extent_tree_range(inode, fofs, len,
675684
tei->blk, 0);

0 commit comments

Comments
 (0)