summaryrefslogtreecommitdiff
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c17
-rw-r--r--net/bluetooth/mgmt.c5
2 files changed, 22 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 728a6ee471ea..84431b86af96 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2715,6 +2715,23 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
case HCISETSCAN:
err = hci_req_sync(hdev, hci_scan_req, dr.dev_opt,
HCI_INIT_TIMEOUT);
+
+ /* Ensure that the connectable state gets correctly
+ * notified if the whitelist is in use.
+ */
+ if (!err && !list_empty(&hdev->whitelist)) {
+ bool changed;
+
+ if ((dr.dev_opt & SCAN_PAGE))
+ changed = !test_and_set_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags);
+ else
+ changed = test_and_set_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags);
+
+ if (changed)
+ mgmt_new_settings(hdev);
+ }
break;
case HCISETLINKPOL:
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 98392d61b78f..91b1f92c681e 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1427,6 +1427,11 @@ static int new_settings(struct hci_dev *hdev, struct sock *skip)
return mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), skip);
}
+int mgmt_new_settings(struct hci_dev *hdev)
+{
+ return new_settings(hdev, NULL);
+}
+
struct cmd_lookup {
struct sock *sk;
struct hci_dev *hdev;