Skip to content

Commit df3d6a3

Browse files
committed
Bluetooth: hci_event: Fix setting DISCOVERY_FINDING for passive scanning
DISCOVERY_FINDING shall only be set for active scanning as passive scanning is not meant to generate MGMT Device Found events causing discovering state to go out of sync since userspace would believe it is discovering when in fact it is just passive scanning. Cc: [email protected] Link: https://bugzilla.kernel.org/show_bug.cgi?id=219088 Fixes: 2e2515c ("Bluetooth: hci_event: Set DISCOVERY_FINDING on SCAN_ENABLED") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 7a8c6fb commit df3d6a3

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

net/bluetooth/hci_core.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
119119
case DISCOVERY_STARTING:
120120
break;
121121
case DISCOVERY_FINDING:
122-
/* If discovery was not started then it was initiated by the
123-
* MGMT interface so no MGMT event shall be generated either
124-
*/
125-
if (old_state != DISCOVERY_STARTING) {
126-
hdev->discovery.state = old_state;
127-
return;
128-
}
129122
mgmt_discovering(hdev, 1);
130123
break;
131124
case DISCOVERY_RESOLVING:

net/bluetooth/hci_event.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,10 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
17211721
switch (enable) {
17221722
case LE_SCAN_ENABLE:
17231723
hci_dev_set_flag(hdev, HCI_LE_SCAN);
1724-
if (hdev->le_scan_type == LE_SCAN_ACTIVE)
1724+
if (hdev->le_scan_type == LE_SCAN_ACTIVE) {
17251725
clear_pending_adv_report(hdev);
1726-
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
1726+
hci_discovery_set_state(hdev, DISCOVERY_FINDING);
1727+
}
17271728
break;
17281729

17291730
case LE_SCAN_DISABLE:

0 commit comments

Comments
 (0)