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.

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: db04662e2f4f ("fs: allow detached mounts in clone_private_mount()")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christian Brauner and committed by
Linus Torvalds
c0dbd11a 56770e24

+2 -1
+2 -1
fs/namespace.c
··· 2478 2478 struct mount *old_mnt = real_mount(path->mnt); 2479 2479 struct mount *new_mnt; 2480 2480 2481 - scoped_guard(rwsem_read, &namespace_sem) 2481 + guard(rwsem_read)(&namespace_sem); 2482 + 2482 2483 if (IS_MNT_UNBINDABLE(old_mnt)) 2483 2484 return ERR_PTR(-EINVAL); 2484 2485