Merge tag 'sound-5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-2.6-microblaze.git] / net / nfc / rawsock.c
index b2061b6..955c195 100644 (file)
@@ -328,10 +328,13 @@ static int rawsock_create(struct net *net, struct socket *sock,
        if ((sock->type != SOCK_SEQPACKET) && (sock->type != SOCK_RAW))
                return -ESOCKTNOSUPPORT;
 
-       if (sock->type == SOCK_RAW)
+       if (sock->type == SOCK_RAW) {
+               if (!capable(CAP_NET_RAW))
+                       return -EPERM;
                sock->ops = &rawsock_raw_ops;
-       else
+       } else {
                sock->ops = &rawsock_ops;
+       }
 
        sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern);
        if (!sk)