Skip to contentSkip to conversation

Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown

PATCH Applied Tzung-Bi Shih 3 participants 3 messages Sep 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown

In btmtksdio_shutdown(), pm_runtime_get_sync() is called at the beginning of the function. However, if sending the WMT function control command fails later, the driver returns early.

It bypasses the corresponding pm_runtime_put_noidle() and pm_runtime_disable() calls, leaking the PM usage counter and leaving PM runtime enabled indefinitely.

Fall through to execute the PM runtime cleanup block even if WMT errors.

Fixes 7f3c563c575e ("Bluetooth: btmtksdio: Add runtime PM support to SDIO based Bluetooth")
---
 drivers/bluetooth/btmtksdio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/bluetooth/btmtksdio.c +1 -3
index fe4ca9395aa3..b7db15268904 100644
@@ -1249,10 +1249,8 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 	wmt_params.status = NULL;
 
 	err = mtk_hci_wmt_sync(hdev, &wmt_params);
-	if (err < 0) {
+	if (err < 0)
 		bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
-		return err;
-	}
 
 ignore_wmt_cmd:
 	pm_runtime_put_noidle(bdev->dev);
Signature · 1 line
2.55.0.1007.g17ff1f9808-goog
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1164398/

---Test result---

Test Summary:

CheckPatch                    PASS      0.48 seconds
VerifyFixes                   PASS      0.09 seconds
VerifySignedoff               PASS      0.09 seconds
GitLint                       PASS      0.26 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      19.44 seconds
CheckAllWarning               PASS      24.61 seconds
CheckSparse                   PASS      24.88 seconds
BuildKernel32                 PASS      23.04 seconds
CheckKernelLLVM               PASS      20.67 seconds
TestRunnerSetup               PASS      486.33 seconds
IncrementalBuild              PASS      22.06 seconds

https://github.com/bluez/bluetooth-next/pull/766

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Tzung-Bi Shih
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 9 lines · On Mon, 14 Sep 2026 09:47:29 +0000 you wrote:

In btmtksdio_shutdown(), pm_runtime_get_sync() is called at the beginning of the function. However, if sending the WMT function control command fails later, the driver returns early.

It bypasses the corresponding pm_runtime_put_noidle() and pm_runtime_disable() calls, leaking the PM usage counter and leaving PM runtime enabled indefinitely.

[...]

Here is the summary with links:
- Bluetooth: btmtksdio: Fix PM runtime reference leak in shutdown
https://git.kernel.org/bluetooth/bluetooth-next/c/d8dd59bd6fd3

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html