[syzbot] [ext4?] [ocfs2?] KASAN: null-ptr-deref Write in jbd2_journal_update_sb_log_tail

Edward Adam Davis
2024-08-19T12:08:09Z

Journal too short will cause ocfs2_check_volume failed, and will set journal->j_sb_buffer to NULL

#syz test: upstream c3f2d783a459

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index afee70125ae3..1ac19ac2ba2c 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1819,6 +1819,9 @@ static int ocfs2_mount_volume(struct super_block *sb)
status = ocfs2_check_volume(osb);
if (status < 0) {
mlog_errno(status);
+ if (status == -EINVAL)
+ osb->s_feature_incompat &=
+ ~OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT;
goto out_system_inodes;
}