]> www.infradead.org Git - nvme.git/commitdiff
Bluetooth: hci_event: Fix setting DISCOVERY_FINDING for passive scanning
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 25 Jul 2024 22:28:08 +0000 (18:28 -0400)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 26 Jul 2024 14:57:09 +0000 (10:57 -0400)
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: stable@vger.kernel.org
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219088
Fixes: 2e2515c1ba38 ("Bluetooth: hci_event: Set DISCOVERY_FINDING on SCAN_ENABLED")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c

index 8a4ebd93adfcd7572f8e481d99be990efed3f153..06da8ac13dca8ef6737a6500f4ef59c1c4e34666 100644 (file)
@@ -119,13 +119,6 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
        case DISCOVERY_STARTING:
                break;
        case DISCOVERY_FINDING:
-               /* If discovery was not started then it was initiated by the
-                * MGMT interface so no MGMT event shall be generated either
-                */
-               if (old_state != DISCOVERY_STARTING) {
-                       hdev->discovery.state = old_state;
-                       return;
-               }
                mgmt_discovering(hdev, 1);
                break;
        case DISCOVERY_RESOLVING:
index dce8035ca7990cfbddbe6a8edf7163fcdad7ee7b..d0c118c47f6c9355d3916c4912f54c930fbf2a94 100644 (file)
@@ -1721,9 +1721,10 @@ static void le_set_scan_enable_complete(struct hci_dev *hdev, u8 enable)
        switch (enable) {
        case LE_SCAN_ENABLE:
                hci_dev_set_flag(hdev, HCI_LE_SCAN);
-               if (hdev->le_scan_type == LE_SCAN_ACTIVE)
+               if (hdev->le_scan_type == LE_SCAN_ACTIVE) {
                        clear_pending_adv_report(hdev);
-               hci_discovery_set_state(hdev, DISCOVERY_FINDING);
+                       hci_discovery_set_state(hdev, DISCOVERY_FINDING);
+               }
                break;
 
        case LE_SCAN_DISABLE: