]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: update s_journal_inum if it changes after journal replay
authorBaokun Li <libaokun1@huawei.com>
Sat, 7 Jan 2023 03:21:26 +0000 (11:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:54 +0000 (13:33 +0100)
commit688f6e0c51abc22cd2973965a1b7309c6b29c97b
tree8f5c2e5b654d1c7d36bfd4f018b0151ec6bead83
parent81f48b3c75fac1d7ff49e191e332c1d561770ad3
ext4: update s_journal_inum if it changes after journal replay

[ Upstream commit 37e7b68bb2b2465a565c4987f36a84980da148ac ]

When mounting a crafted ext4 image, s_journal_inum may change after journal
replay, which is obviously unreasonable because we have successfully loaded
and replayed the journal through the old s_journal_inum. And the new
s_journal_inum bypasses some of the checks in ext4_get_journal(), which
may trigger a null pointer dereference problem. So if s_journal_inum
changes after the journal replay, we ignore the change, and rewrite the
current journal_inum to the superblock.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216541
Reported-by: Luís Henriques <lhenriques@suse.de>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230107032126.4165860-3-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/super.c