Skip to content

Commit

Permalink
Bluetooth: Fix incorrectly setting HCI_CONNECTABLE
Browse files Browse the repository at this point in the history
Since page scan might be enabled by Add Device we should not implicitly
set connectable whenever something else than Set Connectable changes it.
This patch makes sure that we don't set HCI_CONNECTABLE for these cases
if there are any entries in the white list.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Johan Hedberg authored and Marcel Holtmann committed Jul 9, 2014
1 parent a397407 commit dee58c1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -6076,6 +6076,14 @@ void mgmt_connectable(struct hci_dev *hdev, u8 connectable)
if (!connectable && mgmt_pending_find(MGMT_OP_SET_POWERED, hdev))
return;

/* If something else than mgmt changed the page scan state we
* can't differentiate this from a change triggered by adding
* the first element to the whitelist. Therefore, avoid
* incorrectly setting HCI_CONNECTABLE.
*/
if (connectable && !list_empty(&hdev->whitelist))
return;

if (connectable)
changed = !test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
else
Expand Down

0 comments on commit dee58c1

Please sign in to comment.