[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250418140118.1775-1-chenyufeng@iie.ac.cn>
Date: Fri, 18 Apr 2025 22:01:18 +0800
From: Chen Yufeng <chenyufeng@....ac.cn>
To: isdn@...ux-pingi.de
Cc: marcel@...tmann.org,
johan.hedberg@...il.com,
luiz.dentz@...il.com,
chenyufeng@....ac.cn,
netdev@...r.kernel.org
Subject: [PATCH] cmtp: enforce CAP_NET_RAW for raw sockets in cmtp_sock_create()
A patch similar to commit b91ee4aa2a21 ("mISDN: enforce CAP_NET_RAW for
raw sockets").
When creating a raw BLUETOOTH socket, CAP_NET_RAW needs to be checked
first.
Signed-off-by: Chen Yufeng <chenyufeng@....ac.cn>
---
net/bluetooth/cmtp/sock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 96d49d9fae96..00f944f2863f 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -206,6 +206,8 @@ 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)
--
2.34.1
Powered by blists - more mailing lists