From c45d3b149e64250d741d78d94fc41c2c75f72eec Mon Sep 17 00:00:00 2001 From: Eryu Guan Date: Tue, 1 Nov 2011 19:04:59 -0400 Subject: [PATCH] --- yaml --- r: 273186 b: refs/heads/master c: 8762202dd0d6e46854f786bdb6fb3780a1625efe h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/jbd/journal.c | 8 ++++++++ trunk/fs/jbd2/journal.c | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 4af5926069ec..1c8487aec44e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: bf52c6f7af55c48ab0fd5f990460b884b428d906 +refs/heads/master: 8762202dd0d6e46854f786bdb6fb3780a1625efe diff --git a/trunk/fs/jbd/journal.c b/trunk/fs/jbd/journal.c index 9fe061fb8779..fea8dd661d2b 100644 --- a/trunk/fs/jbd/journal.c +++ b/trunk/fs/jbd/journal.c @@ -1135,6 +1135,14 @@ static int journal_get_superblock(journal_t *journal) goto out; } + if (be32_to_cpu(sb->s_first) == 0 || + be32_to_cpu(sb->s_first) >= journal->j_maxlen) { + printk(KERN_WARNING + "JBD: Invalid start block of journal: %u\n", + be32_to_cpu(sb->s_first)); + goto out; + } + return 0; out: diff --git a/trunk/fs/jbd2/journal.c b/trunk/fs/jbd2/journal.c index f24df13adc4e..d6e93d00833e 100644 --- a/trunk/fs/jbd2/journal.c +++ b/trunk/fs/jbd2/journal.c @@ -1251,6 +1251,14 @@ static int journal_get_superblock(journal_t *journal) goto out; } + if (be32_to_cpu(sb->s_first) == 0 || + be32_to_cpu(sb->s_first) >= journal->j_maxlen) { + printk(KERN_WARNING + "JBD2: Invalid start block of journal: %u\n", + be32_to_cpu(sb->s_first)); + goto out; + } + return 0; out: