aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci_core.h8
-rw-r--r--net/bluetooth/hci_core.c5
2 files changed, 9 insertions, 4 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 83ca58b9f4c1..f07b1450b3c2 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -509,6 +509,14 @@ static inline void discovery_init(struct hci_dev *hdev)
509 hdev->discovery.rssi = HCI_RSSI_INVALID; 509 hdev->discovery.rssi = HCI_RSSI_INVALID;
510} 510}
511 511
512static inline void hci_discovery_filter_clear(struct hci_dev *hdev)
513{
514 hdev->discovery.rssi = HCI_RSSI_INVALID;
515 hdev->discovery.uuid_count = 0;
516 kfree(hdev->discovery.uuids);
517 hdev->discovery.uuids = NULL;
518}
519
512bool hci_discovery_active(struct hci_dev *hdev); 520bool hci_discovery_active(struct hci_dev *hdev);
513 521
514void hci_discovery_set_state(struct hci_dev *hdev, int state); 522void hci_discovery_set_state(struct hci_dev *hdev, int state);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 42f86dc3fb40..3c81b5cdda83 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2061,10 +2061,7 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
2061 * count, it is important to actually free the allocated 2061 * count, it is important to actually free the allocated
2062 * list of UUIDs here. 2062 * list of UUIDs here.
2063 */ 2063 */
2064 hdev->discovery.rssi = HCI_RSSI_INVALID; 2064 hci_discovery_filter_clear(hdev);
2065 hdev->discovery.uuid_count = 0;
2066 kfree(hdev->discovery.uuids);
2067 hdev->discovery.uuids = NULL;
2068 2065
2069 if (old_state != DISCOVERY_STARTING) 2066 if (old_state != DISCOVERY_STARTING)
2070 mgmt_discovering(hdev, 0); 2067 mgmt_discovering(hdev, 0);