diff options
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1c593aa0218e..3ec8708989ca 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2211,6 +2211,7 @@ void ext4_group_desc_csum_set(struct super_block *sb, __u32 block_group, | |||
2211 | 2211 | ||
2212 | /* Called at mount-time, super-block is locked */ | 2212 | /* Called at mount-time, super-block is locked */ |
2213 | static int ext4_check_descriptors(struct super_block *sb, | 2213 | static int ext4_check_descriptors(struct super_block *sb, |
2214 | ext4_fsblk_t sb_block, | ||
2214 | ext4_group_t *first_not_zeroed) | 2215 | ext4_group_t *first_not_zeroed) |
2215 | { | 2216 | { |
2216 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2217 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
@@ -2241,6 +2242,11 @@ static int ext4_check_descriptors(struct super_block *sb, | |||
2241 | grp = i; | 2242 | grp = i; |
2242 | 2243 | ||
2243 | block_bitmap = ext4_block_bitmap(sb, gdp); | 2244 | block_bitmap = ext4_block_bitmap(sb, gdp); |
2245 | if (block_bitmap == sb_block) { | ||
2246 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
2247 | "Block bitmap for group %u overlaps " | ||
2248 | "superblock", i); | ||
2249 | } | ||
2244 | if (block_bitmap < first_block || block_bitmap > last_block) { | 2250 | if (block_bitmap < first_block || block_bitmap > last_block) { |
2245 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | 2251 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " |
2246 | "Block bitmap for group %u not in group " | 2252 | "Block bitmap for group %u not in group " |
@@ -2248,6 +2254,11 @@ static int ext4_check_descriptors(struct super_block *sb, | |||
2248 | return 0; | 2254 | return 0; |
2249 | } | 2255 | } |
2250 | inode_bitmap = ext4_inode_bitmap(sb, gdp); | 2256 | inode_bitmap = ext4_inode_bitmap(sb, gdp); |
2257 | if (inode_bitmap == sb_block) { | ||
2258 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
2259 | "Inode bitmap for group %u overlaps " | ||
2260 | "superblock", i); | ||
2261 | } | ||
2251 | if (inode_bitmap < first_block || inode_bitmap > last_block) { | 2262 | if (inode_bitmap < first_block || inode_bitmap > last_block) { |
2252 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | 2263 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " |
2253 | "Inode bitmap for group %u not in group " | 2264 | "Inode bitmap for group %u not in group " |
@@ -2255,6 +2266,11 @@ static int ext4_check_descriptors(struct super_block *sb, | |||
2255 | return 0; | 2266 | return 0; |
2256 | } | 2267 | } |
2257 | inode_table = ext4_inode_table(sb, gdp); | 2268 | inode_table = ext4_inode_table(sb, gdp); |
2269 | if (inode_table == sb_block) { | ||
2270 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | ||
2271 | "Inode table for group %u overlaps " | ||
2272 | "superblock", i); | ||
2273 | } | ||
2258 | if (inode_table < first_block || | 2274 | if (inode_table < first_block || |
2259 | inode_table + sbi->s_itb_per_group - 1 > last_block) { | 2275 | inode_table + sbi->s_itb_per_group - 1 > last_block) { |
2260 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " | 2276 | ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " |
@@ -3757,7 +3773,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3757 | goto failed_mount2; | 3773 | goto failed_mount2; |
3758 | } | 3774 | } |
3759 | } | 3775 | } |
3760 | if (!ext4_check_descriptors(sb, &first_not_zeroed)) { | 3776 | if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { |
3761 | ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); | 3777 | ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); |
3762 | ret = -EFSCORRUPTED; | 3778 | ret = -EFSCORRUPTED; |
3763 | goto failed_mount2; | 3779 | goto failed_mount2; |