diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-07-28 05:09:47 +0200 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-07-28 05:09:47 +0200 |
commit | 78f1ddbb498283c2445c11b0dfa666424c301803 (patch) | |
tree | aa25853e60d224812103ea5b5e520fc41d57cb05 | |
parent | ext4: Fix typo in ext4/Kconfig (diff) | |
download | linux-78f1ddbb498283c2445c11b0dfa666424c301803.tar.xz linux-78f1ddbb498283c2445c11b0dfa666424c301803.zip |
ext4: Avoid null pointer dereference when decoding EROFS w/o a journal
We need to check to make sure a journal is present before checking the
journal flags in ext4_decode_error().
Signed-off-by: Eric Sesterhenn <eric.sesterhenn@lsexperts.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8f4f079e6b9a..fe3f376b7df2 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -344,7 +344,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno, errstr = "Out of memory"; break; case -EROFS: - if (!sb || EXT4_SB(sb)->s_journal->j_flags & JBD2_ABORT) + if (!sb || (EXT4_SB(sb)->s_journal && + EXT4_SB(sb)->s_journal->j_flags & JBD2_ABORT)) errstr = "Journal has aborted"; else errstr = "Readonly filesystem"; |