summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2023-02-01 10:47:47 -0500
committerTheodore Ts'o <tytso@mit.edu>2023-02-01 10:47:47 -0500
commitaf37d677e507a97f4ade39b247cf7ff26d9e0624 (patch)
tree2019db6e495c21242dc5033978e1baa68bd8f97e
parent0bc1e30fcd5fb174d029f2b52921f9138e0efb33 (diff)
downloade2fsprogs-af37d677e507a97f4ade39b247cf7ff26d9e0624.tar.gz
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 <tytso@mit.edu>
-rw-r--r--lib/ext2fs/openfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index fea352f5..fd56a9ac 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 ||