1 ext4: don't allow r/w mounts if metadata blocks overlap the superblock
3 If some metadata block, such as an allocation bitmap, overlaps the
4 superblock, it's very likely that if the file system is mounted
5 read/write, the results will not be pretty. So disallow r/w mounts
6 for file systems corrupted in this particular way.
8 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 Cc: stable@vger.kernel.org
11 fs/ext4/super.c | 6 ++++++
12 1 file changed, 6 insertions(+)
14 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
15 index 7cd022c344d1..edcfe6956eba 100644
18 @@ -2335,6 +2335,8 @@ static int ext4_check_descriptors(struct super_block *sb,
19 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
20 "Block bitmap for group %u overlaps "
25 if (block_bitmap < first_block || block_bitmap > last_block) {
26 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
27 @@ -2347,6 +2349,8 @@ static int ext4_check_descriptors(struct super_block *sb,
28 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
29 "Inode bitmap for group %u overlaps "
34 if (inode_bitmap < first_block || inode_bitmap > last_block) {
35 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
36 @@ -2359,6 +2363,8 @@ static int ext4_check_descriptors(struct super_block *sb,
37 ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
38 "Inode table for group %u overlaps "
43 if (inode_table < first_block ||
44 inode_table + sbi->s_itb_per_group - 1 > last_block) {