Skip to content

Commit

Permalink
ieee802154: enforce CAP_NET_RAW for raw sockets
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ori Nimron authored and David S. Miller committed Sep 24, 2019
1 parent 0614e2b commit e69dbd4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ieee802154/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,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;
Expand Down

0 comments on commit e69dbd4

Please sign in to comment.