mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount
authorEric W. Biederman <ebiederm@xmission.com>
Tue, 29 Jul 2014 00:10:56 +0000 (17:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Sep 2014 16:04:00 +0000 (09:04 -0700)
commit81d4c13ebbdcb69b2d56b3bc5e626b1a881421cf
tree11297f5addd6424eccbb955663f22c4d7b8fe0be
parent8c30f22757c97041750fddce8ea11c6d7231574a
mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount

commit 07b645589dcda8b7a5249e096fece2a67556f0f4 upstream.

There are no races as locked mount flags are guaranteed to never change.

Moving the test into do_remount makes it more visible, and ensures all
filesystem remounts pass the MNT_LOCK_READONLY permission check.  This
second case is not an issue today as filesystem remounts are guarded
by capable(CAP_DAC_ADMIN) and thus will always fail in less privileged
mount namespaces, but it could become an issue in the future.

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c