Commit 78f1ddbb authored by Theodore Ts'o's avatar Theodore Ts'o

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: default avatarEric Sesterhenn <eric.sesterhenn@lsexperts.de>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 43b38520
...@@ -344,7 +344,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno, ...@@ -344,7 +344,8 @@ static const char *ext4_decode_error(struct super_block *sb, int errno,
errstr = "Out of memory"; errstr = "Out of memory";
break; break;
case -EROFS: 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"; errstr = "Journal has aborted";
else else
errstr = "Readonly filesystem"; errstr = "Readonly filesystem";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment