]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Bluetooth: btusb: Reject autosuspend if discovery is active
authorLinmao Li <lilinmao@kylinos.cn>
Fri, 9 Jan 2026 02:05:38 +0000 (10:05 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 29 Jan 2026 18:33:15 +0000 (13:33 -0500)
If USB autosuspend occurs while discovery is active, the ongoing
HCI operation may not complete successfully. On some devices, this
can leave discovery.state stuck in DISCOVERY_FINDING.

Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btusb.c

index b16eb9d70dcf9875645a0ce02056371bbf8eeaec..1e01f8c855c98c951256e2c0e8a32595b0f4fc1b 100644 (file)
@@ -4472,10 +4472,11 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
 
        BT_DBG("intf %p", intf);
 
-       /* Don't auto-suspend if there are connections; external suspend calls
-        * shall never fail.
+       /* Don't auto-suspend if there are connections or discovery in
+        * progress; external suspend calls shall never fail.
         */
-       if (PMSG_IS_AUTO(message) && hci_conn_count(data->hdev))
+       if (PMSG_IS_AUTO(message) &&
+           (hci_conn_count(data->hdev) || hci_discovery_active(data->hdev)))
                return -EBUSY;
 
        if (data->suspend_count++)