Skip to contentSkip to conversation

Bluetooth: Fix accepting connections when not using mgmt

PATCH In review Johan Hedberg 2 participants 2 messages Dec 24, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Bluetooth: Fix accepting connections when not using mgmt

From: Johan Hedberg <[email protected]>

When connectable mode is enabled (page scan on) through some non-mgmt method the HCI_CONNECTABLE flag will not be set. For backwards compatibility with user space versions not using mgmt we should not require HCI_CONNECTABLE to be set if HCI_MGMT is not set.

---
v2: Add clarifying code comment

 net/bluetooth/hci_event.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
net/bluetooth/hci_event.c +6 -1
index c03d4b09caa3..3f2e8b830cbd 100644
@@ -2197,7 +2197,12 @@ static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
 		return;
 	}
 
-	if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
+	/* Require HCI_CONNECTABLE or a whitelist entry to accept the
+	 * connection. These features are only touched through mgmt so
+	 * only do the checks if HCI_MGMT is set.
+	 */
+	if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
+	    !test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
 	    !hci_bdaddr_list_lookup(&hdev->whitelist, &ev->bdaddr,
 				    BDADDR_BREDR)) {
 		    hci_reject_conn(hdev, &ev->bdaddr);
Signature · 1 line
2.1.0
maintainer
#1 lore raw

Hi Johan,

Quoted 5 lines

When connectable mode is enabled (page scan on) through some non-mgmt method the HCI_CONNECTABLE flag will not be set. For backwards compatibility with user space versions not using mgmt we should not require HCI_CONNECTABLE to be set if HCI_MGMT is not set.

Quoted 8 lines

---
v2: Add clarifying code comment

net/bluetooth/hci_event.c | 7 ++++++-

1 file changed, 6 insertions(+), 1 deletion(-)

patch has been applied bluetooth tree.

Regards

Marcel