M701: add is_reboot_charging function, avoid to charging display error.
[firefly-linux-kernel-4.4.55.git] / fs / jbd2 / journal.c
index 0dfa5b598e68fa3f358f043c442eb39558bf6f52..40c5fb73e9c696cbede4bbb5b6a66c372bf3d125 100644 (file)
@@ -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: