Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kernfs: Acquire kernfs_rwsem in kernfs_node_dentry().

kernfs_node_dentry() passes kernfs_node::name to
lookup_positive_unlocked().

Acquire kernfs_root::kernfs_rwsem to ensure the node is not renamed
during the operation.

Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20250213145023.2820193-4-bigeasy@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sebastian Andrzej Siewior and committed by
Greg Kroah-Hartman
5b2fabf7 122ab92d

+4
+4
fs/kernfs/mount.c
··· 209 209 { 210 210 struct dentry *dentry; 211 211 struct kernfs_node *knparent; 212 + struct kernfs_root *root; 212 213 213 214 BUG_ON(sb->s_op != &kernfs_sops); 214 215 ··· 218 217 /* Check if this is the root kernfs_node */ 219 218 if (!kn->parent) 220 219 return dentry; 220 + 221 + root = kernfs_root(kn); 222 + guard(rwsem_read)(&root->kernfs_rwsem); 221 223 222 224 knparent = find_next_ancestor(kn, NULL); 223 225 if (WARN_ON(!knparent)) {