summaryrefslogtreecommitdiffstats
path: root/kernel/fs/ext4/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fs/ext4/balloc.c')
-rw-r--r--kernel/fs/ext4/balloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/fs/ext4/balloc.c b/kernel/fs/ext4/balloc.c
index fe1f50fe7..f97110461 100644
--- a/kernel/fs/ext4/balloc.c
+++ b/kernel/fs/ext4/balloc.c
@@ -208,6 +208,9 @@ static int ext4_init_block_bitmap(struct super_block *sb,
memset(bh->b_data, 0, sb->s_blocksize);
bit_max = ext4_num_base_meta_clusters(sb, block_group);
+ if ((bit_max >> 3) >= bh->b_size)
+ return -EFSCORRUPTED;
+
for (bit = 0; bit < bit_max; bit++)
ext4_set_bit(bit, bh->b_data);