reiserfs: add check for invalid 1st journal block
authorPavel Skripkin <paskripkin@gmail.com>
Mon, 17 May 2021 12:15:45 +0000 (15:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jul 2021 07:44:39 +0000 (09:44 +0200)
commit69a71b59b18c321b59b347328483a70438bf9456
treeda6d098d9df0e58d7ca526853f4b81aa95545b5b
parentc5073100dc4f671b4460f4653453a08f46ad7e91
reiserfs: add check for invalid 1st journal block

[ Upstream commit a149127be52fa7eaf5b3681a0317a2bbb772d5a9 ]

syzbot reported divide error in reiserfs.
The problem was in incorrect journal 1st block.

Syzbot's reproducer manualy generated wrong superblock
with incorrect 1st block. In journal_init() wasn't
any checks about this particular case.

For example, if 1st journal block is before superblock
1st block, it can cause zeroing important superblock members
in do_journal_end().

Link: https://lore.kernel.org/r/20210517121545.29645-1-paskripkin@gmail.com
Reported-by: syzbot+0ba9909df31c6a36974d@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/reiserfs/journal.c