[2/5] ieee802154: enforce CAP_NET_RAW for raw sockets
diff mbox series

Message ID 20191003181318.19616-3-tyhicks@canonical.com
State New
Headers show
Series
  • CVE-2019-1705{2, 3, 4, 5, 6}: Missing CAP_NET_RAW checks
Related show

Commit Message

Tyler Hicks Oct. 3, 2019, 6:13 p.m. UTC
From: Ori Nimron <orinimron123@gmail.com>

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>

CVE-2019-17053

(cherry picked from commit e69dbd4619e7674c1679cba49afd9dd9ac347eef)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
---
 net/ieee802154/socket.c | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

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;