summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/hci_ldisc.c
diff options
context:
space:
mode:
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>2021-09-22 14:56:56 +0300
committerMarcel Holtmann <marcel@holtmann.org>2021-09-22 17:14:21 +0300
commitc05731d0c6bd9a625e27ea5c5157ebf1303229e0 (patch)
tree8db1fda90e62e2f0c2f1090f0cd1b11d0196af35 /drivers/bluetooth/hci_ldisc.c
parent24ff62ae383f776ab0285f2996de6bd9bb2d2e4b (diff)
downloadlinux-c05731d0c6bd9a625e27ea5c5157ebf1303229e0.tar.xz
Bluetooth: hci_ldisc: require CAP_NET_ADMIN to attach N_HCI ldisc
Any unprivileged user can attach N_HCI ldisc and send packets coming from a virtual controller by using PTYs. Require initial namespace CAP_NET_ADMIN to do that. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_ldisc.c')
-rw-r--r--drivers/bluetooth/hci_ldisc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index 5ed2cfa7da1d..5e32e4d5367a 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -479,6 +479,9 @@ static int hci_uart_tty_open(struct tty_struct *tty)
BT_DBG("tty %p", tty);
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
+
/* Error if the tty has no write op instead of leaving an exploitable
* hole
*/