Commit a3faa7eb authored by Edward Adam Davis's avatar Edward Adam Davis Committed by openeuler-sync-bot
Browse files

jfs: fix uaf in jfs_evict_inode

stable inclusion
from stable-v5.10.167
commit bc6ef64dbe71136f327d63b2b9071b828af2c2a8
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I96G7N
CVE: CVE-2023-52600

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=bc6ef64dbe71136f327d63b2b9071b828af2c2a8



--------------------------------

[ 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: default avatar <syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com>
Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
Signed-off-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
(cherry picked from commit b9783760)
parent 928c80ea
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -172,15 +172,15 @@ int jfs_mount(struct super_block *sb)
	}
	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 */
	if ((rc = diMount(ipimap))) {
		jfs_err("jfs_mount: diMount failed w/rc = %d", rc);
		goto err_ipimap;
	}

	/* map further access of per fileset inodes by the fileset inode */
	sbi->ipimap = ipimap;

	return rc;

	/*