]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/user_namespace.c
userns: Changing any namespace id mappings should require privileges
[karo-tx-linux.git] / kernel / user_namespace.c
index 5c16f3aa757a0353f8d7621b6b9d16cd586b347e..e134d8f365ddea425ac6a8df541875038928298d 100644 (file)
@@ -613,10 +613,10 @@ static ssize_t map_write(struct file *file, const char __user *buf,
        if (map->nr_extents != 0)
                goto out;
 
-       /* Require the appropriate privilege CAP_SETUID or CAP_SETGID
-        * over the user namespace in order to set the id mapping.
+       /*
+        * Adjusting namespace settings requires capabilities on the target.
         */
-       if (cap_valid(cap_setid) && !ns_capable(ns, cap_setid))
+       if (cap_valid(cap_setid) && !file_ns_capable(file, ns, CAP_SYS_ADMIN))
                goto out;
 
        /* Get a buffer */