summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-09 12:59:16 +0300
committerMarcel Holtmann <marcel@holtmann.org>2014-07-09 12:25:27 +0200
commitdee58c1ed5e29eb57fa9358a8ff27848b72f3b7d (patch)
treec31692907bf7e4e97db6fa792ea13b054741e590
parenta397407f266f8dcb6ea7b28cbff9d9cbd87b6ca8 (diff)
downloadlinux-dee58c1ed5e29eb57fa9358a8ff27848b72f3b7d.tar.bz2
Bluetooth: Fix incorrectly setting HCI_CONNECTABLE
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>
-rw-r--r--net/bluetooth/mgmt.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 72ff19f26991..5a866b65371c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -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