]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: btusb: fix wakeup source leak on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 4 Jun 2026 06:37:38 +0000 (08:37 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 11 Jun 2026 18:24:40 +0000 (14:24 -0400)
Make sure to disable wakeup on probe failure to avoid leaking the wakeup
source.

Fixes: fd913ef7ce61 ("Bluetooth: btusb: Add out-of-band wakeup support")
Cc: stable@vger.kernel.org # 4.11
Cc: Rajat Jain <rajatja@google.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btusb.c

index 669fb3ebde4c886a074b18a36258f2b6d2a9b5ad..966e017ac1dfe8bf70bb87e2e8e01710e6c87cee 100644 (file)
@@ -3013,6 +3013,11 @@ static int marvell_config_oob_wake(struct hci_dev *hdev)
 
        return 0;
 }
+#else
+static inline int marvell_config_oob_wake(struct hci_dev *hdev)
+{
+       return 0;
+}
 #endif
 
 static int btusb_set_bdaddr_marvell(struct hci_dev *hdev,
@@ -3855,6 +3860,11 @@ static int btusb_config_oob_wake(struct hci_dev *hdev)
        bt_dev_info(hdev, "OOB Wake-on-BT configured at IRQ %u", irq);
        return 0;
 }
+#else
+static inline int btusb_config_oob_wake(struct hci_dev *hdev)
+{
+       return 0;
+}
 #endif
 
 static void btusb_check_needs_reset_resume(struct usb_interface *intf)
@@ -4191,7 +4201,6 @@ static int btusb_probe(struct usb_interface *intf,
        hdev->wakeup  = btusb_wakeup;
        hdev->hci_drv = &btusb_hci_drv;
 
-#ifdef CONFIG_PM
        err = btusb_config_oob_wake(hdev);
        if (err)
                goto out_free_dev;
@@ -4200,9 +4209,9 @@ static int btusb_probe(struct usb_interface *intf,
        if (id->driver_info & BTUSB_MARVELL && data->oob_wake_irq) {
                err = marvell_config_oob_wake(hdev);
                if (err)
-                       goto out_free_dev;
+                       goto err_disable_wakeup;
        }
-#endif
+
        if (id->driver_info & BTUSB_CW6622)
                hci_set_quirk(hdev, HCI_QUIRK_BROKEN_STORED_LINK_KEY);
 
@@ -4447,6 +4456,9 @@ err_release_siblings:
        }
 err_kill_tx_urbs:
        usb_kill_anchored_urbs(&data->tx_anchor);
+err_disable_wakeup:
+       if (data->oob_wake_irq)
+               device_init_wakeup(&data->udev->dev, false);
 out_free_dev:
        if (data->reset_gpio)
                gpiod_put(data->reset_gpio);