diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2014-08-13 04:33:38 -0400 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2014-12-02 11:46:39 -0500 |
commit | 3e1866410f11356a9fd869beb3e95983dc79c067 (patch) | |
tree | 4c617a54e8239301118d7dc469a2db42acfed042 /fs/namespace.c | |
parent | 5d01410fe4d92081f349b013a2e7a95429e4f2c9 (diff) |
mnt: Implicitly add MNT_NODEV on remount when it was implicitly added by mount
Now that remount is properly enforcing the rule that you can't remove
nodev at least sandstorm.io is breaking when performing a remount.
It turns out that there is an easy intuitive solution implicitly
add nodev on remount when nodev was implicitly added on mount.
Tested-by: Cedric Bosdonnat <cbosdonnat@suse.com>
Tested-by: Richard Weinberger <richard@nod.at>
Cc: stable@vger.kernel.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 5b66b2b3624d..3a1a87dc33df 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -2098,7 +2098,13 @@ static int do_remount(struct path *path, int flags, int mnt_flags, | |||
2098 | } | 2098 | } |
2099 | if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) && | 2099 | if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) && |
2100 | !(mnt_flags & MNT_NODEV)) { | 2100 | !(mnt_flags & MNT_NODEV)) { |
2101 | return -EPERM; | 2101 | /* Was the nodev implicitly added in mount? */ |
2102 | if ((mnt->mnt_ns->user_ns != &init_user_ns) && | ||
2103 | !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) { | ||
2104 | mnt_flags |= MNT_NODEV; | ||
2105 | } else { | ||
2106 | return -EPERM; | ||
2107 | } | ||
2102 | } | 2108 | } |
2103 | if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) && | 2109 | if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) && |
2104 | !(mnt_flags & MNT_NOSUID)) { | 2110 | !(mnt_flags & MNT_NOSUID)) { |