diff options
author | Ori Nimron <orinimron123@gmail.com> | 2019-09-20 09:35:48 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-24 16:37:18 +0200 |
commit | e69dbd4619e7674c1679cba49afd9dd9ac347eef (patch) | |
tree | 27bbf6c1121c32d7768e83c03f8bdc47a74123b5 /net/ieee802154/socket.c | |
parent | ax25: enforce CAP_NET_RAW for raw sockets (diff) | |
download | linux-e69dbd4619e7674c1679cba49afd9dd9ac347eef.tar.xz linux-e69dbd4619e7674c1679cba49afd9dd9ac347eef.zip |
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>
Diffstat (limited to 'net/ieee802154/socket.c')
-rw-r--r-- | net/ieee802154/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index badc5cfe4dc6..d93d4531aa9b 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -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; |