aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric W. Biederman2013-03-22 05:10:15 -0500
committerGreg Kroah-Hartman2013-04-05 11:26:01 -0500
commit2f8d2ffe267ddb8d28dbed0ebb2d8dcf47c629fd (patch)
treeb7ade27e695ed1369b362441bdda7b9eaa196f94 /fs
parent7f60ac1533f522fe257dca74fbb4c4d3820a9b0f (diff)
downloadkernel-omap-2f8d2ffe267ddb8d28dbed0ebb2d8dcf47c629fd.tar.gz
kernel-omap-2f8d2ffe267ddb8d28dbed0ebb2d8dcf47c629fd.tar.xz
kernel-omap-2f8d2ffe267ddb8d28dbed0ebb2d8dcf47c629fd.zip
vfs: Add a mount flag to lock read only bind mounts
commit 90563b198e4c6674c63672fae1923da467215f45 upstream. When a read-only bind mount is copied from mount namespace in a higher privileged user namespace to a mount namespace in a lesser privileged user namespace, it should not be possible to remove the the read-only restriction. Add a MNT_LOCK_READONLY mount flag to indicate that a mount must remain read-only. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 8edbad385cb7..8b025dfa143a 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1736,6 +1736,9 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags)
1736 if (readonly_request == __mnt_is_readonly(mnt)) 1736 if (readonly_request == __mnt_is_readonly(mnt))
1737 return 0; 1737 return 0;
1738 1738
1739 if (mnt->mnt_flags & MNT_LOCK_READONLY)
1740 return -EPERM;
1741
1739 if (readonly_request) 1742 if (readonly_request)
1740 error = mnt_make_readonly(real_mount(mnt)); 1743 error = mnt_make_readonly(real_mount(mnt));
1741 else 1744 else