diff options
-rw-r--r-- | fs/ext4/balloc.c | 3 | ||||
-rw-r--r-- | fs/ext4/super.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 0b8105b3293d..799a92bdf577 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -208,6 +208,9 @@ static int ext4_init_block_bitmap(struct super_block *sb, | |||
208 | memset(bh->b_data, 0, sb->s_blocksize); | 208 | memset(bh->b_data, 0, sb->s_blocksize); |
209 | 209 | ||
210 | bit_max = ext4_num_base_meta_clusters(sb, block_group); | 210 | bit_max = ext4_num_base_meta_clusters(sb, block_group); |
211 | if ((bit_max >> 3) >= bh->b_size) | ||
212 | return -EFSCORRUPTED; | ||
213 | |||
211 | for (bit = 0; bit < bit_max; bit++) | 214 | for (bit = 0; bit < bit_max; bit++) |
212 | ext4_set_bit(bit, bh->b_data); | 215 | ext4_set_bit(bit, bh->b_data); |
213 | 216 | ||
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 5664ee66b301..13c49af7a06a 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3416,6 +3416,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3416 | goto failed_mount; | 3416 | goto failed_mount; |
3417 | } | 3417 | } |
3418 | 3418 | ||
3419 | if (le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) > (blocksize / 4)) { | ||
3420 | ext4_msg(sb, KERN_ERR, | ||
3421 | "Number of reserved GDT blocks insanely large: %d", | ||
3422 | le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks)); | ||
3423 | goto failed_mount; | ||
3424 | } | ||
3425 | |||
3419 | if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { | 3426 | if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { |
3420 | err = bdev_dax_supported(sb, blocksize); | 3427 | err = bdev_dax_supported(sb, blocksize); |
3421 | if (err) | 3428 | if (err) |