ppp: allow usage in namespaces
authorMatteo Croce <mcroce@redhat.com>
Fri, 27 Oct 2017 18:08:23 +0000 (20:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 Oct 2017 02:55:32 +0000 (11:55 +0900)
Check for CAP_NET_ADMIN with ns_capable() instead of capable()
to allow usage of ppp in user namespace other than the init one.

Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ppp/ppp_generic.c

index 6566107cef84fae6c9a00660b7d2d5f63d313596..af7f93ed1487a1687982c46a168a79d28b618027 100644 (file)
@@ -390,7 +390,7 @@ static int ppp_open(struct inode *inode, struct file *file)
        /*
         * This could (should?) be enforced by the permissions on /dev/ppp.
         */
-       if (!capable(CAP_NET_ADMIN))
+       if (!ns_capable(file->f_cred->user_ns, CAP_NET_ADMIN))
                return -EPERM;
        return 0;
 }