[PATCH] Bluetooth: Fix missing HCI_RAW check when binding USER_CHANNEL socket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Johan Hedberg <johan.hedberg@xxxxxxxxx>

HCI devices in RAW mode will have the HCI_UP flag set. The existing
hci_sock_bind code, when invoked on a HCI_CHANNEL_USER socket, tests
for this flag and will return EBUSY, making it impossible to bind any
HCI device RAW mode. This patch adds an extra condition for the
HCI_RAW flag to make it possible for bind() to succeed.

Signed-off-by: Johan Hedberg <johan.hedberg@xxxxxxxxx>
---
 net/bluetooth/hci_sock.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index 150556345263..6588929b4d26 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -754,6 +754,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr,
 		    hci_dev_test_flag(hdev, HCI_SETUP) ||
 		    hci_dev_test_flag(hdev, HCI_CONFIG) ||
 		    (!hci_dev_test_flag(hdev, HCI_AUTO_OFF) &&
+		     !test_bit(HCI_RAW, &hdev->flags) &&
 		     test_bit(HCI_UP, &hdev->flags))) {
 			err = -EBUSY;
 			hci_dev_put(hdev);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux