aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/l2cap.c2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv6/af_inet6.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 365ae161d702..ff0233df6246 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -832,7 +832,7 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol,
832 sock->type != SOCK_DGRAM && sock->type != SOCK_RAW) 832 sock->type != SOCK_DGRAM && sock->type != SOCK_RAW)
833 return -ESOCKTNOSUPPORT; 833 return -ESOCKTNOSUPPORT;
834 834
835 if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) 835 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
836 return -EPERM; 836 return -EPERM;
837 837
838 sock->ops = &l2cap_sock_ops; 838 sock->ops = &l2cap_sock_ops;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5c7e42c02afb..7d12c6a9b19b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -326,7 +326,7 @@ lookup_protocol:
326 } 326 }
327 327
328 err = -EPERM; 328 err = -EPERM;
329 if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) 329 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
330 goto out_rcu_unlock; 330 goto out_rcu_unlock;
331 331
332 err = -EAFNOSUPPORT; 332 err = -EAFNOSUPPORT;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 45ed5e05ab32..12e69d364dd5 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -159,7 +159,7 @@ lookup_protocol:
159 } 159 }
160 160
161 err = -EPERM; 161 err = -EPERM;
162 if (sock->type == SOCK_RAW && !capable(CAP_NET_RAW)) 162 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
163 goto out_rcu_unlock; 163 goto out_rcu_unlock;
164 164
165 sock->ops = answer->ops; 165 sock->ops = answer->ops;