summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f0018562b028..42f86dc3fb40 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2052,6 +2052,20 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
case DISCOVERY_STOPPED:
hci_update_background_scan(hdev);
+ /* Reset RSSI and UUID filters to ensure Start Discovery
+ * and Start Service Discovery operate properly no matter
+ * which one started the previous discovery.
+ *
+ * While the Start Discovery and Start Service Discovery
+ * operations will set proper values for RSSI and UUID
+ * count, it is important to actually free the allocated
+ * list of UUIDs here.
+ */
+ hdev->discovery.rssi = HCI_RSSI_INVALID;
+ hdev->discovery.uuid_count = 0;
+ kfree(hdev->discovery.uuids);
+ hdev->discovery.uuids = NULL;
+
if (old_state != DISCOVERY_STARTING)
mgmt_discovering(hdev, 0);
break;