Skip to contentSkip to conversation

Bluetooth: hci_uart: add missing NULL check in h5_enqueue

PATCH Applied Pavel Skripkin 4 participants 4 messages Mar 13, 2022 – Mar 14, 2022 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_uart: add missing NULL check in h5_enqueue

Syzbot hit general protection fault in __pm_runtime_resume(). The problem was in missing NULL check.

hu->serdev can be NULL and we should not blindly pass &serdev->dev somewhere, since it will cause GPF.

Reported-by [email protected]
Fixes d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
---
 drivers/bluetooth/hci_h5.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_h5.c +5 -3
index 34286ffe0568..7ac6908a4dfb 100644
@@ -629,9 +629,11 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)
 		break;
 	}
 
-	pm_runtime_get_sync(&hu->serdev->dev);
-	pm_runtime_mark_last_busy(&hu->serdev->dev);
-	pm_runtime_put_autosuspend(&hu->serdev->dev);
+	if (hu->serdev) {
+		pm_runtime_get_sync(&hu->serdev->dev);
+		pm_runtime_mark_last_busy(&hu->serdev->dev);
+		pm_runtime_put_autosuspend(&hu->serdev->dev);
+	}
 
 	return 0;
 }
Signature · 1 line
2.35.1
#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/project/bluetooth/list/?series=622982

---Test result---

Test Summary:

CheckPatch                    PASS      1.70 seconds
GitLint                       PASS      1.03 seconds
SubjectPrefix                 PASS      0.89 seconds
BuildKernel                   PASS      35.65 seconds
BuildKernel32                 PASS      31.37 seconds
Incremental Build with patchesPASS      42.73 seconds
TestRunner: Setup             PASS      550.01 seconds
TestRunner: l2cap-tester      PASS      17.10 seconds
TestRunner: bnep-tester       PASS      7.11 seconds
TestRunner: mgmt-tester       PASS      112.17 seconds
TestRunner: rfcomm-tester     PASS      9.00 seconds
TestRunner: sco-tester        PASS      8.81 seconds
TestRunner: smp-tester        PASS      8.80 seconds
TestRunner: userchan-tester   PASS      7.39 seconds

---
Regards,
Linux Bluetooth

maintainer
#2 lore raw
In reply to Pavel Skripkin

Hi Pavel,

Quoted 6 lines

Syzbot hit general protection fault in __pm_runtime_resume(). The problem was in missing NULL check.

hu->serdev can be NULL and we should not blindly pass &serdev->dev somewhere, since it will cause GPF.

Quoted 6 lines
Reported-by [email protected]
Fixes d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")

---
drivers/bluetooth/hci_h5.c | 8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)

patch has been applied to bluetooth-next tree.

However if someone would finally step up and write a standalone serdev only driver for 3-Wire UART support, this would not be a problem in the first place. We are just applying on bandaid after another.

Regards

Marcel

#3 lore raw
In reply to Pavel Skripkin
This patch was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Quoted 11 lines · On Sun, 13 Mar 2022 20:49:36 +0300 you wrote:

Syzbot hit general protection fault in __pm_runtime_resume(). The problem was in missing NULL check.

hu->serdev can be NULL and we should not blindly pass &serdev->dev somewhere, since it will cause GPF.

Reported-by [email protected]
Fixes d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")

[...]

Here is the summary with links:
- Bluetooth: hci_uart: add missing NULL check in h5_enqueue

    https://git.kernel.org/bluetooth/bluetooth-next/c/928df045e94e

You are awesome, thank you!

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