Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107529
b: refs/heads/master
c: 8a26646
h: refs/heads/master
i:
  107527: 04b3b9a
v: v3
  • Loading branch information
Theodore Ts'o committed Jul 26, 2008
1 parent e5e9d31 commit a32267a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d03856bd5e5abac717da137dc60fe4a691769bd0
refs/heads/master: 8a266467b8c4841ca994d0fe59f39e584650e3df
24 changes: 23 additions & 1 deletion trunk/fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,8 @@ static int ext4_check_descriptors(struct super_block *sb)
"Checksum for group %lu failed (%u!=%u)\n",
i, le16_to_cpu(ext4_group_desc_csum(sbi, i,
gdp)), le16_to_cpu(gdp->bg_checksum));
return 0;
if (!(sb->s_flags & MS_RDONLY))
return 0;
}
if (!flexbg_flag)
first_block += EXT4_BLOCKS_PER_GROUP(sb);
Expand Down Expand Up @@ -2961,6 +2962,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
ext4_fsblk_t n_blocks_count = 0;
unsigned long old_sb_flags;
struct ext4_mount_options old_opts;
ext4_group_t g;
int err;
#ifdef CONFIG_QUOTA
int i;
Expand Down Expand Up @@ -3038,6 +3040,26 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
goto restore_opts;
}

/*
* Make sure the group descriptor checksums
* are sane. If they aren't, refuse to
* remount r/w.
*/
for (g = 0; g < sbi->s_groups_count; g++) {
struct ext4_group_desc *gdp =
ext4_get_group_desc(sb, g, NULL);

if (!ext4_group_desc_csum_verify(sbi, g, gdp)) {
printk(KERN_ERR
"EXT4-fs: ext4_remount: "
"Checksum for group %lu failed (%u!=%u)\n",
g, le16_to_cpu(ext4_group_desc_csum(sbi, g, gdp)),
le16_to_cpu(gdp->bg_checksum));
err = -EINVAL;
goto restore_opts;
}
}

/*
* If we have an unprocessed orphan list hanging
* around from a previously readonly bdev mount,
Expand Down

0 comments on commit a32267a

Please sign in to comment.