aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/hci_core.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8b3f839ba826..523700eefdd1 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2052,17 +2052,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
2052 case DISCOVERY_STOPPED: 2052 case DISCOVERY_STOPPED:
2053 hci_update_background_scan(hdev); 2053 hci_update_background_scan(hdev);
2054 2054
2055 /* Reset RSSI and UUID filters to ensure Start Discovery
2056 * and Start Service Discovery operate properly no matter
2057 * which one started the previous discovery.
2058 *
2059 * While the Start Discovery and Start Service Discovery
2060 * operations will set proper values for RSSI and UUID
2061 * count, it is important to actually free the allocated
2062 * list of UUIDs here.
2063 */
2064 hci_discovery_filter_clear(hdev);
2065
2066 if (old_state != DISCOVERY_STARTING) 2055 if (old_state != DISCOVERY_STARTING)
2067 mgmt_discovering(hdev, 0); 2056 mgmt_discovering(hdev, 0);
2068 break; 2057 break;
@@ -5679,6 +5668,15 @@ void hci_update_background_scan(struct hci_dev *hdev)
5679 if (hdev->discovery.state != DISCOVERY_STOPPED) 5668 if (hdev->discovery.state != DISCOVERY_STOPPED)
5680 return; 5669 return;
5681 5670
5671 /* Reset RSSI and UUID filters when starting background scanning
5672 * since these filters are meant for service discovery only.
5673 *
5674 * The Start Discovery and Start Service Discovery operations
5675 * ensure to set proper values for RSSI threshold and UUID
5676 * filter list. So it is safe to just reset them here.
5677 */
5678 hci_discovery_filter_clear(hdev);
5679
5682 hci_req_init(&req, hdev); 5680 hci_req_init(&req, hdev);
5683 5681
5684 if (list_empty(&hdev->pend_le_conns) && 5682 if (list_empty(&hdev->pend_le_conns) &&