summaryrefslogtreecommitdiff
path: root/fs/ext4/balloc.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-08-18 12:33:31 +0800
committerAlex Shi <alex.shi@linaro.org>2016-08-18 12:33:31 +0800
commitfdd85431d91c9da37e9e696eb8fe80f1a2dcdbeb (patch)
treeac60b28ebed345df274ce42aa3c9f3ee091875d1 /fs/ext4/balloc.c
parente01035c1a71d7cceebc3df92f79577df7438523a (diff)
parente779279da78339ec75fa72571ef901a447762cc6 (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r--fs/ext4/balloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index fe1f50fe764f..f97110461c19 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,
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);