[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190920073549.517481-6-gregkh@linuxfoundation.org>
Date: Fri, 20 Sep 2019 09:35:49 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: netdev@...r.kernel.org
Cc: isdn@...ux-pingi.de, jreuter@...na.de, ralf@...ux-mips.org,
alex.aring@...il.com, stefan@...enfreihafen.org,
orinimron123@...il.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 5/5] nfc: enforce CAP_NET_RAW for raw sockets
From: Ori Nimron <orinimron123@...il.com>
When creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked
first.
Signed-off-by: Ori Nimron <orinimron123@...il.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
net/nfc/llcp_sock.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 9b8742947aff..8dfea26536c9 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -1004,10 +1004,13 @@ static int llcp_sock_create(struct net *net, struct socket *sock,
sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;
- if (sock->type == SOCK_RAW)
+ if (sock->type == SOCK_RAW) {
+ if (!capable(CAP_NET_RAW))
+ return -EPERM;
sock->ops = &llcp_rawsock_ops;
- else
+ } else {
sock->ops = &llcp_sock_ops;
+ }
sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern);
if (sk == NULL)
--
2.23.0
Powered by blists - more mailing lists