Message ID | 1422483682-15393-70-git-send-email-kamal@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/fs/namespace.c b/fs/namespace.c index fe2b527..32f2b2d 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1945,7 +1945,13 @@ static int do_remount(struct path *path, int flags, int mnt_flags, } if ((mnt->mnt.mnt_flags & MNT_LOCK_NODEV) && !(mnt_flags & MNT_NODEV)) { - return -EPERM; + /* Was the nodev implicitly added in mount? */ + if ((mnt->mnt_ns->user_ns != &init_user_ns) && + !(sb->s_type->fs_flags & FS_USERNS_DEV_MOUNT)) { + mnt_flags |= MNT_NODEV; + } else { + return -EPERM; + } } if ((mnt->mnt.mnt_flags & MNT_LOCK_NOSUID) && !(mnt_flags & MNT_NOSUID)) {