summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEdward Adam Davis <eadavis@qq.com>2023-10-31 08:39:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-23 10:24:55 +0300
commit93df0a2a0b3cde2d7ab3a52ed46ea1d6d4aaba5f (patch)
tree84691df65df5383a45f5b1ede15644aedb7afc58 /fs
parent3f8217c323fd6ecd6829a0c3ae7ac3f14eac368e (diff)
downloadlinux-93df0a2a0b3cde2d7ab3a52ed46ea1d6d4aaba5f.tar.xz
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/jfs/jfs_mount.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c
index d41733540df9..459324f3570a 100644
--- a/fs/jfs/jfs_mount.c
+++ b/fs/jfs/jfs_mount.c
@@ -171,15 +171,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;
/*