cifs: fix lock length calculation
[linux-2.6-microblaze.git] / fs / namespace.c
index afe2b64..e6a7e76 100644 (file)
@@ -1760,7 +1760,7 @@ out_unlock:
 /*
  * Is the caller allowed to modify his namespace?
  */
-static inline bool may_mount(void)
+bool may_mount(void)
 {
        return ns_capable(current->nsproxy->mnt_ns->user_ns, CAP_SYS_ADMIN);
 }
@@ -4026,8 +4026,9 @@ static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt)
 static inline bool mnt_allow_writers(const struct mount_kattr *kattr,
                                     const struct mount *mnt)
 {
-       return !(kattr->attr_set & MNT_READONLY) ||
-              (mnt->mnt.mnt_flags & MNT_READONLY);
+       return (!(kattr->attr_set & MNT_READONLY) ||
+               (mnt->mnt.mnt_flags & MNT_READONLY)) &&
+              !kattr->mnt_userns;
 }
 
 static int mount_setattr_prepare(struct mount_kattr *kattr, struct mount *mnt)