OSDN Git Service

[PATCH] JBD: avoid panic on corrupted journal superblock (from akpm)
authorWilly TARREAU <willy@pcw.(none)>
Sun, 21 May 2006 23:08:34 +0000 (19:08 -0400)
committerMarcelo Tosatti <marcelo@dmt.cnet>
Fri, 26 May 2006 19:35:58 +0000 (16:35 -0300)
Initial patch from Andrew Morton merged into 2.6 :
Don't panic if the journal superblock is wrecked: just fail the mount.

fs/jbd/recovery.c

index c02a0ef..d18df61 100644 (file)
@@ -138,8 +138,11 @@ static int jread(struct buffer_head **bhp, journal_t *journal,
 
        *bhp = NULL;
 
-       J_ASSERT (offset < journal->j_maxlen);
-       
+       if (offset >= journal->j_maxlen) {
+               printk(KERN_ERR "JBD: corrupted journal superblock\n");
+               return -EIO;
+       }
+
        err = journal_bmap(journal, offset, &blocknr);
 
        if (err) {