summaryrefslogtreecommitdiffstats
path: root/mount
diff options
context:
space:
mode:
authorKarel Zak2010-08-27 12:22:27 +0200
committerKarel Zak2010-08-27 12:22:27 +0200
commit0828125895f7323e39b87673dbdbef4c70da5fdb (patch)
tree77569e6303f1cf72ca2ad123dbd61d3fe56ecf66 /mount
parentmount: Add more pseudo filesystems. (diff)
downloadkernel-qcow2-util-linux-0828125895f7323e39b87673dbdbef4c70da5fdb.tar.gz
kernel-qcow2-util-linux-0828125895f7323e39b87673dbdbef4c70da5fdb.tar.xz
kernel-qcow2-util-linux-0828125895f7323e39b87673dbdbef4c70da5fdb.zip
mount: sanity check mount flags for MS_PROPAGATION
mount(8) reuses mount flags from fstab/mtab, the problem is that for MS_PROPAGATION operations kernel incorrectly evaluates mount flags if the flags contains any non-propagation stuff (e.g. MS_RDONLY). For example --make-shared on read-only FS: # strace -e mount mount --make-shared /mnt/test mount("/dev/sda1", "/mnt/test", "none", MS_RDONLY|MS_SHARED, NULL) = 0 must be: # strace -e mount mount --make-shared /mnt/test mount("/dev/sda1", "/mnt/test", "none", MS_SHARED, NULL) = 0 Reported-by: Valerie Aurora <vaurora@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r--mount/mount.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mount/mount.c b/mount/mount.c
index 2e819e95b..f2b6ee23e 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -491,9 +491,11 @@ parse_opts (const char *options, int *flags, char **extra_opts) {
if (readwrite)
*flags &= ~MS_RDONLY;
- if (mounttype & MS_PROPAGATION)
- *flags &= ~MS_BIND;
*flags |= mounttype;
+
+ /* The propagation flags should not be used together with any other flags */
+ if (*flags & MS_PROPAGATION)
+ *flags &= MS_PROPAGATION;
}
/* Try to build a canonical options string. */