Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net/bluetooth/cmtp/sock.c: add CAP_NET_RAW check.
@ 2020-08-18 8:15 Qingyu Li
2020-08-18 18:30 ` Jesse Brandeburg
0 siblings, 1 reply; 2+ messages in thread
From: Qingyu Li @ 2020-08-18 8:15 UTC (permalink / raw)
To: marcel, johan.hedberg, davem, kuba, isdn
Cc: linux-bluetooth, netdev, linux-kernel
When creating a raw PF_BLUETOOTH socket,
CAP_NET_RAW needs to be checked first.
Signed-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>
---
net/bluetooth/cmtp/sock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 96d49d9fae96..476ccc9bee7c 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -207,6 +207,9 @@ static int cmtp_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, &cmtp_proto, kern);
if (!sk)
return -ENOMEM;
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] net/bluetooth/cmtp/sock.c: add CAP_NET_RAW check.
2020-08-18 8:15 [PATCH] net/bluetooth/cmtp/sock.c: add CAP_NET_RAW check Qingyu Li
@ 2020-08-18 18:30 ` Jesse Brandeburg
0 siblings, 0 replies; 2+ messages in thread
From: Jesse Brandeburg @ 2020-08-18 18:30 UTC (permalink / raw)
To: Qingyu Li
Cc: marcel, johan.hedberg, davem, kuba, isdn, linux-bluetooth,
netdev, linux-kernel
On Tue, 18 Aug 2020 16:15:55 +0800
Qingyu Li <ieatmuttonchuan@gmail.com> wrote:
> When creating a raw PF_BLUETOOTH socket,
> CAP_NET_RAW needs to be checked first.
Please see my previous replies.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-18 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 8:15 [PATCH] net/bluetooth/cmtp/sock.c: add CAP_NET_RAW check Qingyu Li
2020-08-18 18:30 ` Jesse Brandeburg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).