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>
This commit is contained in:
Edward Adam Davis 2023-10-31 13:39:04 +08:00 committed by Greg Kroah-Hartman
parent 70780914cb
commit 32e8f2d955
1 changed files with 3 additions and 3 deletions

View File

@ -172,15 +172,15 @@ int jfs_mount(struct super_block *sb)
} }
jfs_info("jfs_mount: ipimap:0x%p", ipimap); jfs_info("jfs_mount: ipimap:0x%p", ipimap);
/* map further access of per fileset inodes by the fileset inode */
sbi->ipimap = ipimap;
/* initialize fileset inode allocation map */ /* initialize fileset inode allocation map */
if ((rc = diMount(ipimap))) { if ((rc = diMount(ipimap))) {
jfs_err("jfs_mount: diMount failed w/rc = %d", rc); jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
goto err_ipimap; goto err_ipimap;
} }
/* map further access of per fileset inodes by the fileset inode */
sbi->ipimap = ipimap;
return rc; return rc;
/* /*