Messages in this thread Patch in this message | | | Date | Tue, 18 Aug 2020 15:56:48 +0800 | From | Qingyu Li <> | Subject | [PATCH] net/bluetooth/hci_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@gmail.com> --- net/bluetooth/hci_sock.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 251b9128f530..c0919e209f05 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -2034,6 +2034,9 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol, if (sock->type != SOCK_RAW) return -ESOCKTNOSUPPORT;
+ if (!capable(CAP_NET_RAW)) + return -EPERM; + sock->ops = &hci_sock_ops;
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, kern); -- 2.17.1
| |