From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu, darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 2/4] ext4: validate external journal superblock checksum
Date: Wed, 10 Sep 2014 17:28:32 -0700 [thread overview]
Message-ID: <20140911002831.10109.84707.stgit@birch.djwong.org> (raw)
In-Reply-To: <20140911002818.10109.51772.stgit@birch.djwong.org>
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>
---
fs/ext4/super.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7045f1d..222ed5d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4372,6 +4372,15 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
goto out_bdev;
}
+ if ((le32_to_cpu(es->s_feature_ro_compat) &
+ EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) &&
+ es->s_checksum != ext4_superblock_csum(sb, es)) {
+ ext4_msg(sb, KERN_ERR, "external journal has "
+ "corrupt superblock");
+ brelse(bh);
+ goto out_bdev;
+ }
+
if (memcmp(EXT4_SB(sb)->s_es->s_journal_uuid, es->s_uuid, 16)) {
ext4_msg(sb, KERN_ERR, "journal UUID does not match");
brelse(bh);
next prev parent reply other threads:[~2014-09-11 0:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 0:28 [PATCH 0/4] ext4/jbd2: misc 3.17 bugfixes Darrick J. Wong
2014-09-11 0:28 ` [PATCH 1/4] jbd2: fix journal checksum feature flag handling Darrick J. Wong
2014-09-11 15:47 ` Theodore Ts'o
2014-09-11 0:28 ` Darrick J. Wong [this message]
2014-09-11 13:25 ` [PATCH 2/4] ext4: validate external journal superblock checksum Jan Kara
2014-09-11 15:47 ` Theodore Ts'o
2014-09-11 17:11 ` Darrick J. Wong
2014-09-11 0:28 ` [PATCH 3/4] jbd2: restart replay without revokes if journal block csum fails Darrick J. Wong
2014-09-11 13:15 ` Jan Kara
2014-09-11 17:30 ` Darrick J. Wong
2014-09-11 17:43 ` Darrick J. Wong
2014-09-12 9:59 ` Jan Kara
2014-09-11 0:28 ` [PATCH 4/4] ext4: don't keep using page if inline conversion fails Darrick J. Wong
2014-09-11 13:17 ` Jan Kara
2014-09-11 15:46 ` Theodore Ts'o
2014-09-11 20:35 ` [PATCH 5/4] ext4: check EA value offset when loading Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140911002831.10109.84707.stgit@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).