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>
Thu, 22 Nov 2018 06:32:48 +0000 (07:32 +0100)
commit5bcdd9f4ef33e381a00b94c071768973dc936646
treee7e1c8540cb8aeb4c3284d01a11c1ed527dd7c6c
parentf1dbaa10a0ec858cfe538d6dd1d40f7314563292
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