summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorOri Nimron <orinimron123@gmail.com>2019-09-20 09:35:48 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-05 12:27:43 +0200
commita279cd311c1e3870de25fe48e948487b4785e9cd (patch)
treec2a0faf9300bab8d95f56a0a5ac72c31db117d15 /net
parentc15d89b5cb86dfcdee536d093ece512091ed6e5c (diff)
ieee802154: enforce CAP_NET_RAW for raw sockets
[ Upstream commit e69dbd4619e7674c1679cba49afd9dd9ac347eef ] When creating a raw AF_IEEE802154 socket, CAP_NET_RAW needs to be checked first. Signed-off-by: Ori Nimron <orinimron123@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index 47b397264f24..cb6c0772ea36 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -999,6 +999,9 @@ static int ieee802154_create(struct net *net, struct socket *sock,
switch (sock->type) {
case SOCK_RAW:
+ rc = -EPERM;
+ if (!capable(CAP_NET_RAW))
+ goto out;
proto = &ieee802154_raw_prot;
ops = &ieee802154_raw_ops;
break;