ext2: Add check if block is step over super block
RFC PATCH 1/1 ext2: Add check if block is step over super block
We got an issue that super block is allocated by file system when run syzkaller test. We add debug information find that origin image super block's block bitmap is zero. There isn't check whether block is step over super block in ext2_new_blocks.
In order not to make things worse, we'd better to add check if block step over super block when new blocks.
Signed-off-by Ye Bin <[email protected]>
--- fs/ext2/balloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext2/balloc.c +2 -1
@@ -1376,7 +1376,8 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal, in_range(ret_block, le32_to_cpu(gdp->bg_inode_table), EXT2_SB(sb)->s_itb_per_group) || in_range(ret_block + num - 1, le32_to_cpu(gdp->bg_inode_table), - EXT2_SB(sb)->s_itb_per_group)) { + EXT2_SB(sb)->s_itb_per_group) || + in_range(EXT2_SB(sb)->s_sb_block, ret_block, num)) { ext2_error(sb, "ext2_new_blocks", "Allocating block in system zone - " "blocks from "E2FSBLK", length %lu",
Signature · 1 line
2.31.1