From: Theodore Ts'o Date: Wed, 1 Feb 2023 15:47:47 +0000 (-0500) Subject: libext2fs: reject opening a file system where the blocks per group < 8 X-Git-Tag: v1.46.6~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=af37d677e507a97f4ade39b247cf7ff26d9e0624;p=tools%2Fe2fsprogs.git libext2fs: reject opening a file system where the blocks per group < 8 A file system where the superblock claims that the blocks per group is less than 8 is invalid, so let's reject it at ext2fs_open() time. Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index fea352f..fd56a9a 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -385,7 +385,7 @@ retry: * Read group descriptors */ blocks_per_group = EXT2_BLOCKS_PER_GROUP(fs->super); - if (blocks_per_group == 0 || + if (blocks_per_group < 8 || blocks_per_group > EXT2_MAX_BLOCKS_PER_GROUP(fs->super) || fs->inode_blocks_per_group > EXT2_MAX_INODES_PER_GROUP(fs->super) || EXT2_DESC_PER_BLOCK(fs->super) == 0 ||