diff options
author | Jan Kara <jack@suse.cz> | 2009-07-15 20:36:08 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-07-15 21:26:23 +0200 |
commit | 7447a668a3860b66b3c9db86fdea91e355ba59ac (patch) | |
tree | f27e2c1df19e6558bce053e8ffa12bd121a30947 /fs/jbd | |
parent | e9e961c9a818a2f24711af493b907a8e40a69efc (diff) | |
download | linux-3.10-7447a668a3860b66b3c9db86fdea91e355ba59ac.tar.gz linux-3.10-7447a668a3860b66b3c9db86fdea91e355ba59ac.tar.bz2 linux-3.10-7447a668a3860b66b3c9db86fdea91e355ba59ac.zip |
jbd: Fail to load a journal if it is too short
Due to on disk corruption, it can happen that journal is too short. Fail
to load it in such case so that we don't oops somewhere later.
Reported-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/jbd')
-rw-r--r-- | fs/jbd/journal.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 737f7246a4b..94a64a199a6 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -848,6 +848,12 @@ static int journal_reset(journal_t *journal) first = be32_to_cpu(sb->s_first); last = be32_to_cpu(sb->s_maxlen); + if (first + JFS_MIN_JOURNAL_BLOCKS > last + 1) { + printk(KERN_ERR "JBD: Journal too short (blocks %lu-%lu).\n", + first, last); + journal_fail_superblock(journal); + return -EINVAL; + } journal->j_first = first; journal->j_last = last; |