Whamcloud - gitweb
libext2fs: reject opening a file system where the blocks per group < 8
authorTheodore Ts'o <tytso@mit.edu>
Wed, 1 Feb 2023 15:47:47 +0000 (10:47 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Feb 2023 15:47:47 +0000 (10:47 -0500)
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>
lib/ext2fs/openfs.c

index fea352f..fd56a9a 100644 (file)
@@ -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 ||