aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2014-09-11 11:44:36 -0400
committerTheodore Ts'o <tytso@mit.edu>2014-09-11 11:44:36 -0400
commitdf4763bea5b04d8eed941cfe3df51f22cfe95570 (patch)
treebc084484cb2c1b14db9c1558a23a6ebc16b05ee7 /fs/ext4/super.c
parentfeb8c6d3dd0f2cc0e1c3376d099cf298c5f2c2c8 (diff)
ext4: validate external journal superblock checksum
If the external journal device has metadata_csum enabled, verify that the superblock checksum matches the block before we try to mount. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fb219b95f8d2..263201793c65 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4414,6 +4414,15 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
4414 goto out_bdev; 4414 goto out_bdev;
4415 } 4415 }
4416 4416
4417 if ((le32_to_cpu(es->s_feature_ro_compat) &
4418 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) &&
4419 es->s_checksum != ext4_superblock_csum(sb, es)) {
4420 ext4_msg(sb, KERN_ERR, "external journal has "
4421 "corrupt superblock");
4422 brelse(bh);
4423 goto out_bdev;
4424 }
4425
4417 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) { 4426 if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) {
4418 ext4_msg(sb, KERN_ERR, "journal UUID does not match"); 4427 ext4_msg(sb, KERN_ERR, "journal UUID does not match");
4419 brelse(bh); 4428 brelse(bh);