All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: btusb: Fix leaked runtime PM reference in btusb_reset()
@ 2026-08-18  7:52 Jiajia Liu
  2026-08-18  7:52 ` [PATCH 2/2] Bluetooth: btusb: mediatek: Fix leaked runtime PM reference in reset Jiajia Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiajia Liu @ 2026-08-18  7:52 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Ying Hsu, Archie Pusaka,
	Abhishek Pandit-Subedi, Matthias Brugger,
	AngeloGioacchino Del Regno, Jing Cai, Sean Wang, Chris Lu
  Cc: linux-bluetooth, linux-kernel, linux-arm-kernel, linux-mediatek,
	Jiajia Liu

btusb_reset() calls usb_autopm_get_interface() to resume the device
before queuing a reset of it, but never calls the matching
usb_autopm_put_interface().

usb_queue_reset_device() ends up in usb_reset_device(), and since
btusb provides no pre_reset/post_reset callbacks the interface is
merely unbound and rebound: the interface device object survives
this cycle, and so does its PM usage count, which is not cleared
when the driver is unbound.

As a result every reset permanently leaks a PM usage reference,
preventing the interface from being runtime suspended again until it
is unbound.

Calling usb_autopm_put_interface() right after queuing the reset: the
reset runs asynchronously in a workqueue and usb_reset_device()
resumes the device on its own.

Fixes: c9209b269afd ("Bluetooth: btusb: Introduce generic USB reset")
Assisted-by: Claude:qwen3.8-max
Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
---
 drivers/bluetooth/btusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 2bae85b0016c..cc19828893c6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1051,7 +1051,6 @@ static void btusb_reset(struct hci_dev *hdev)
 	int err;
 
 	data = hci_get_drvdata(hdev);
-	/* This is not an unbalanced PM reference since the device will reset */
 	err = usb_autopm_get_interface(data->intf);
 	if (err) {
 		bt_dev_err(hdev, "Failed usb_autopm_get_interface: %d", err);
@@ -1060,6 +1059,7 @@ static void btusb_reset(struct hci_dev *hdev)
 
 	bt_dev_err(hdev, "Resetting usb device.");
 	usb_queue_reset_device(data->intf);
+	usb_autopm_put_interface(data->intf);
 }
 
 static void btusb_intel_reset(struct hci_dev *hdev)
-- 
2.55.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-18  9:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18  7:52 [PATCH 1/2] Bluetooth: btusb: Fix leaked runtime PM reference in btusb_reset() Jiajia Liu
2026-08-18  7:52 ` [PATCH 2/2] Bluetooth: btusb: mediatek: Fix leaked runtime PM reference in reset Jiajia Liu
2026-08-18  8:32 ` [1/2] Bluetooth: btusb: Fix leaked runtime PM reference in btusb_reset() bluez.test.bot
2026-08-18  9:56 ` [PATCH 1/2] " Jiajia Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.