diff options
author | 2025-02-13 15:50:19 +0100 | |
---|---|---|
committer | 2025-02-15 17:46:32 +0100 | |
commit | 122ab92dee80582c39740609a627198dd5b6b595 (patch) | |
tree | 844eef25fcb95ace56d2c2d8c89b1c615b569e8a /fs/kernfs | |
parent | kernfs: Acquire kernfs_rwsem in kernfs_notify_workfn(). (diff) | |
download | wireguard-linux-122ab92dee80582c39740609a627198dd5b6b595.tar.xz wireguard-linux-122ab92dee80582c39740609a627198dd5b6b595.zip |
kernfs: Acquire kernfs_rwsem in kernfs_get_parent_dentry().
kernfs_get_parent_dentry() passes kernfs_node::parent to
kernfs_get_inode().
Acquire kernfs_root::kernfs_rwsem to ensure kernfs_node::parent isn't
replaced 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-3-bigeasy@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs')
-rw-r--r-- | fs/kernfs/mount.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 1358c21837f1..b9b16e97bff1 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c @@ -145,7 +145,9 @@ static struct dentry *kernfs_fh_to_parent(struct super_block *sb, static struct dentry *kernfs_get_parent_dentry(struct dentry *child) { struct kernfs_node *kn = kernfs_dentry_node(child); + struct kernfs_root *root = kernfs_root(kn); + guard(rwsem_read)(&root->kernfs_rwsem); return d_obtain_alias(kernfs_get_inode(child->d_sb, kn->parent)); } |