]> 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>
Sun, 6 Jul 2025 08:58:00 +0000 (10:58 +0200)
commitd3615894f7073d65e3816826192a83ada29d7779
treeb6013054b7f56773d6ba50c6d0664fed996dacf3
parent6eb211788e1370af52a245d4d7da35c374c7b401
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