]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: require cluster size == block_size when opening a !bigalloc fs
authorTheodore Ts'o <tytso@mit.edu>
Sat, 4 Jun 2011 20:36:19 +0000 (16:36 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 4 Jun 2011 20:36:19 +0000 (16:36 -0400)
In ext2fs_open() check to make sure the cluster size superblock field
is the same as the block size field when the bigalloc feature is not
set.  This is necessary since we will start introducing calculations
based on the cluster size field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/openfs.c

index a20b923a095c2cbf22f06239bdb67e4b215e8450..f87c171701b98bfcd87d87268eb89bd2fe3f260d 100644 (file)
@@ -239,6 +239,12 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
                retval = EXT2_ET_CORRUPT_SUPERBLOCK;
                goto cleanup;
        }
+       if (!EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+                                       EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
+           (fs->super->s_log_block_size != fs->super->s_log_cluster_size)) {
+               retval = EXT2_ET_CORRUPT_SUPERBLOCK;
+               goto cleanup;
+       }
        fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
        if (EXT2_INODE_SIZE(fs->super) < EXT2_GOOD_OLD_INODE_SIZE) {
                retval = EXT2_ET_CORRUPT_SUPERBLOCK;