ieee802154: enforce CAP_NET_RAW for raw sockets
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>
This commit is contained in:
parent
0614e2b737
commit
e69dbd4619
|
@ -1008,6 +1008,9 @@ static int ieee802154_create(struct net *net, struct socket *sock,
|
||||||
|
|
||||||
switch (sock->type) {
|
switch (sock->type) {
|
||||||
case SOCK_RAW:
|
case SOCK_RAW:
|
||||||
|
rc = -EPERM;
|
||||||
|
if (!capable(CAP_NET_RAW))
|
||||||
|
goto out;
|
||||||
proto = &ieee802154_raw_prot;
|
proto = &ieee802154_raw_prot;
|
||||||
ops = &ieee802154_raw_ops;
|
ops = &ieee802154_raw_ops;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue