Skip to content

Commit c0dbd11

Browse files
braunertorvalds
authored andcommitted
fs: actually hold the namespace semaphore
Don't use a scoped guard that only protects the next statement. Use a regular guard to make sure that the namespace semaphore is held across the whole function. Signed-off-by: Christian Brauner <brauner@kernel.org> Reported-by: Leon Romanovsky <leon@kernel.org> Link: https://lore.kernel.org/all/20250401170715.GA112019@unreal/ Fixes: db04662 ("fs: allow detached mounts in clone_private_mount()") Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 56770e2 commit c0dbd11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/namespace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,8 @@ struct vfsmount *clone_private_mount(const struct path *path)
24782478
struct mount *old_mnt = real_mount(path->mnt);
24792479
struct mount *new_mnt;
24802480

2481-
scoped_guard(rwsem_read, &namespace_sem)
2481+
guard(rwsem_read)(&namespace_sem);
2482+
24822483
if (IS_MNT_UNBINDABLE(old_mnt))
24832484
return ERR_PTR(-EINVAL);
24842485

0 commit comments

Comments
 (0)