[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200818082103.GA2692@oppo>
Date: Tue, 18 Aug 2020 16:21:03 +0800
From: Qingyu Li <ieatmuttonchuan@...il.com>
To: marcel@...tmann.org, johan.hedberg@...il.com, davem@...emloft.net,
kuba@...nel.org
Cc: linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net/bluetooth/hidp/sock.c: add CAP_NET_RAW check.
When creating a raw PF_BLUETOOTH socket,
CAP_NET_RAW needs to be checked first.
Signed-off-by: Qingyu Li <ieatmuttonchuan@...il.com>
---
net/bluetooth/hidp/sock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c
index 595fb3c9d6c3..3dd9c8e0419a 100644
--- a/net/bluetooth/hidp/sock.c
+++ b/net/bluetooth/hidp/sock.c
@@ -255,6 +255,9 @@ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol,
if (sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;
+ if (!capable(CAP_NET_RAW))
+ return -EPERM;
+
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, kern);
if (!sk)
return -ENOMEM;
--
2.17.1
Powered by blists - more mailing lists