aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2014-07-28 16:26:53 -0700
committerSimon Shields <keepcalm444@gmail.com>2016-03-15 17:58:54 +1100
commit260325caf43c98bd8ca8146ffe4730017ebdab44 (patch)
tree392a36e464580319c58ceffdf229ae2b8dbe863e /fs
parent8132aca1c841f92e8a3f1398f724251e3d68d757 (diff)
downloadkernel_samsung_smdk4412-260325caf43c98bd8ca8146ffe4730017ebdab44.zip
kernel_samsung_smdk4412-260325caf43c98bd8ca8146ffe4730017ebdab44.tar.gz
kernel_samsung_smdk4412-260325caf43c98bd8ca8146ffe4730017ebdab44.tar.bz2
mnt: Only change user settable mount flags in remount
commit a6138db815df5ee542d848318e5dae681590fccd upstream. Kenton Varda <kenton@sandstorm.io> discovered that by remounting a read-only bind mount read-only in a user namespace the MNT_LOCK_READONLY bit would be cleared, allowing an unprivileged user to the remount a read-only mount read-write. Correct this by replacing the mask of mount flags to preserve with a mask of mount flags that may be changed, and preserve all others. This ensures that any future bugs with this mask and remount will fail in an easy to detect way where new mount flags simply won't change. Change-Id: I8ab8bda03a14b9b43e78f1dc6c818bbec048e986 Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Francis Moreau <francis.moro@gmail.com> Signed-off-by: Zefan Li <lizefan@huawei.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index b3d8f51..912d273 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1842,7 +1842,7 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
err = do_remount_sb(sb, flags, data, 0);
if (!err) {
br_write_lock(vfsmount_lock);
- mnt_flags |= path->mnt->mnt_flags & MNT_PROPAGATION_MASK;
+ mnt_flags |= path->mnt->mnt_flags & ~MNT_USER_SETTABLE_MASK;
path->mnt->mnt_flags = mnt_flags;
br_write_unlock(vfsmount_lock);
}