mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 13:14:07 +08:00
jbd2: 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. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
parent
78f1ddbb49
commit
f6f50e28f0
@ -1187,6 +1187,12 @@ static int journal_reset(journal_t *journal)
|
||||
|
||||
first = be32_to_cpu(sb->s_first);
|
||||
last = be32_to_cpu(sb->s_maxlen);
|
||||
if (first + JBD2_MIN_JOURNAL_BLOCKS > last + 1) {
|
||||
printk(KERN_ERR "JBD: Journal too short (blocks %llu-%llu).\n",
|
||||
first, last);
|
||||
journal_fail_superblock(journal);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
journal->j_first = first;
|
||||
journal->j_last = last;
|
||||
|
Loading…
Reference in New Issue
Block a user