mount: Retest MNT_LOCKED in do_umount
authorEric W. Biederman <ebiederm@xmission.com>
Mon, 22 Oct 2018 15:21:38 +0000 (10:21 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Nov 2018 08:19:22 +0000 (09:19 +0100)
commit32224b874cd879f4385a5f39cf760b8f09db09c8
tree07c384c9cd8e332d854782b27b48a1accfb42107
parent4d01f0310cd0b9fae6b9b6ede317d33beb96be4f
mount: Retest MNT_LOCKED in do_umount

commit 25d202ed820ee347edec0bf3bf553544556bf64b upstream.

It was recently pointed out that the one instance of testing MNT_LOCKED
outside of the namespace_sem is in ksys_umount.

Fix that by adding a test inside of do_umount with namespace_sem and
the mount_lock held.  As it helps to fail fails the existing test is
maintained with an additional comment pointing out that it may be racy
because the locks are not held.

Cc: stable@vger.kernel.org
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Fixes: 5ff9d8a65ce8 ("vfs: Lock in place mounts from more privileged users")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c