aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <[email protected]>2025-02-13 14:50:21 +0000
committerGreg Kroah-Hartman <[email protected]>2025-02-15 16:46:32 +0000
commit9aab10a0249eab4ec77c6a5e4f66442610c12a09 (patch)
tree87eb2bae7d80588d6e45562faa07d85922e0426d /security/selinux/hooks.c
parentkernfs: Acquire kernfs_rwsem in kernfs_node_dentry(). (diff)
downloadkernel-9aab10a0249eab4ec77c6a5e4f66442610c12a09.tar.gz
kernel-9aab10a0249eab4ec77c6a5e4f66442610c12a09.zip
kernfs: Don't re-lock kernfs_root::kernfs_rwsem in kernfs_fop_readdir().
The readdir operation iterates over all entries and invokes dir_emit() for every entry passing kernfs_node::name as argument. Since the name argument can change, and become invalid, the kernfs_root::kernfs_rwsem lock should not be dropped to prevent renames during the operation. The lock drop around dir_emit() has been initially introduced in commit 1e5289c97bba2 ("sysfs: Cache the last sysfs_dirent to improve readdir scalability v2") to avoid holding a global lock during a page fault. The lock drop is wrong since the support of renames and not a big burden since the lock is no longer global. Don't re-acquire kernfs_root::kernfs_rwsem while copying the name to the userpace buffer. Acked-by: Tejun Heo <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'security/selinux/hooks.c')
0 files changed, 0 insertions, 0 deletions