Since various parts of the library depend on the value of s_desc_size,
check to make sure it is the correct, expected value based on the file
system features.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
ec EXT2_ET_MMP_OPEN_DIRECT,
"MMP: open with O_DIRECT failed"
+ec EXT2_ET_BAD_DESC_SIZE,
+ "Block group descriptor size incorrect"
+
end
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
+
+ /* Enforce the block group descriptor size */
+ if (fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) {
+ if (fs->super->s_desc_size != EXT2_MIN_DESC_SIZE_64BIT) {
+ retval = EXT2_ET_BAD_DESC_SIZE;
+ goto cleanup;
+ }
+ } else {
+ if (fs->super->s_desc_size &&
+ fs->super->s_desc_size != EXT2_MIN_DESC_SIZE) {
+ retval = EXT2_ET_BAD_DESC_SIZE;
+ goto cleanup;
+ }
+ }
+
fs->cluster_ratio_bits = fs->super->s_log_cluster_size -
fs->super->s_log_block_size;
if (EXT2_BLOCKS_PER_GROUP(fs->super) !=