]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
attach_recursive_mnt(): do not lock the covering tree when sliding something under it
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 22 Jun 2025 22:03:29 +0000 (18:03 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:38 +0000 (15:57 +0200)
commit6b4ce195552b32902c62c73e508797064c4d4f0c
tree4a38e79eebb922995bdd4ff56317c72f3540688b
parentc3fb926abe90d86f5e3055e0035f04d9892a118b
attach_recursive_mnt(): do not lock the covering tree when sliding something under it

[ Upstream commit ce7df19686530920f2f6b636e71ce5eb1d9303ef ]

If we are propagating across the userns boundary, we need to lock the
mounts added there.  However, in case when something has already
been mounted there and we end up sliding a new tree under that,
the stuff that had been there before should not get locked.

IOW, lock_mnt_tree() should be called before we reparent the
preexisting tree on top of what we are adding.

Fixes: 3bd045cc9c4b ("separate copying and locking mount tree on cross-userns copies")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/namespace.c