]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
do_umount(): add missing barrier before refcount checks in sync case
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 29 Apr 2025 03:56:14 +0000 (23:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:20:38 +0000 (08:20 +0200)
commit7ced6fd9d6f87adb4b0f0cbf96983be83f061b4d
tree5fcfd9eb4bf00d820ee5b4e27171c4b578af8f91
parentf04583e37b5eb0e9952d9d46007a42a093db1dda
do_umount(): add missing barrier before refcount checks in sync case

[ Upstream commit 65781e19dcfcb4aed1167d87a3ffcc2a0c071d47 ]

do_umount() analogue of the race fixed in 119e1ef80ecf "fix
__legitimize_mnt()/mntput() race".  Here we want to make sure that
if __legitimize_mnt() doesn't notice our lock_mount_hash(), we will
notice their refcount increment.  Harder to hit than mntput_no_expire()
one, fortunately, and consequences are milder (sync umount acting
like umount -l on a rare race with RCU pathwalk hitting at just the
wrong time instead of use-after-free galore mntput_no_expire()
counterpart used to be hit).  Still a bug...

Fixes: 48a066e72d97 ("RCU'd vfsmounts")
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/namespace.c