diff options
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 3fa93665b4a3..df92e3ec9913 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -122,6 +122,7 @@ static struct buffer_head * | |||
122 | ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | 122 | ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) |
123 | { | 123 | { |
124 | struct ext4_group_desc *desc; | 124 | struct ext4_group_desc *desc; |
125 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
125 | struct buffer_head *bh = NULL; | 126 | struct buffer_head *bh = NULL; |
126 | ext4_fsblk_t bitmap_blk; | 127 | ext4_fsblk_t bitmap_blk; |
127 | int err; | 128 | int err; |
@@ -131,6 +132,12 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
131 | return ERR_PTR(-EFSCORRUPTED); | 132 | return ERR_PTR(-EFSCORRUPTED); |
132 | 133 | ||
133 | bitmap_blk = ext4_inode_bitmap(sb, desc); | 134 | bitmap_blk = ext4_inode_bitmap(sb, desc); |
135 | if ((bitmap_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || | ||
136 | (bitmap_blk >= ext4_blocks_count(sbi->s_es))) { | ||
137 | ext4_error(sb, "Invalid inode bitmap blk %llu in " | ||
138 | "block_group %u", bitmap_blk, block_group); | ||
139 | return ERR_PTR(-EFSCORRUPTED); | ||
140 | } | ||
134 | bh = sb_getblk(sb, bitmap_blk); | 141 | bh = sb_getblk(sb, bitmap_blk); |
135 | if (unlikely(!bh)) { | 142 | if (unlikely(!bh)) { |
136 | ext4_error(sb, "Cannot read inode bitmap - " | 143 | ext4_error(sb, "Cannot read inode bitmap - " |