jfs: fix uaf in jfs_evict_inode
authorEdward Adam Davis <eadavis@qq.com>
Tue, 31 Oct 2023 05:39:04 +0000 (13:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:16 +0000 (20:14 +0000)
commit1696d6d7d4a1b373e96428d0fe1166bd7c3c795e
tree7444ed6302860e717bddc27691599c50e77561f4
parent2e16a1389b5a7983b45cb2aa20b0e3f0ee364d6c
jfs: fix uaf in jfs_evict_inode

[ Upstream commit e0e1958f4c365e380b17ccb35617345b31ef7bf3 ]

When the execution of diMount(ipimap) fails, the object ipimap that has been
released may be accessed in diFreeSpecial(). Asynchronous ipimap release occurs
when rcu_core() calls jfs_free_node().

Therefore, when diMount(ipimap) fails, sbi->ipimap should not be initialized as
ipimap.

Reported-and-tested-by: syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/jfs/jfs_mount.c