All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue
@ 2022-03-13 17:49 Pavel Skripkin
  2022-03-13 19:04 ` bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Skripkin @ 2022-03-13 17:49 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz, hildawu, apusaka
  Cc: linux-bluetooth, linux-kernel, Pavel Skripkin,
	syzbot+b9bd12fbed3485a3e51f

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: syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com
Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/bluetooth/hci_h5.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 34286ffe0568..7ac6908a4dfb 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -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;
 }
-- 
2.35.1


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

* RE: Bluetooth: hci_uart: add missing NULL check in h5_enqueue
  2022-03-13 17:49 [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue Pavel Skripkin
@ 2022-03-13 19:04 ` bluez.test.bot
  2022-03-14 15:34 ` [PATCH] " Marcel Holtmann
  2022-03-14 15:40 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-03-13 19:04 UTC (permalink / raw)
  To: linux-bluetooth, paskripkin

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

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


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

* Re: [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue
  2022-03-13 17:49 [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue Pavel Skripkin
  2022-03-13 19:04 ` bluez.test.bot
@ 2022-03-14 15:34 ` Marcel Holtmann
  2022-03-14 15:40 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2022-03-14 15:34 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Johan Hedberg, Luiz Augusto von Dentz, Hilda Wu, Archie Pusaka,
	BlueZ, LKML, syzbot+b9bd12fbed3485a3e51f

Hi Pavel,

> 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: syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com
> Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> ---
> 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


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

* Re: [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue
  2022-03-13 17:49 [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue Pavel Skripkin
  2022-03-13 19:04 ` bluez.test.bot
  2022-03-14 15:34 ` [PATCH] " Marcel Holtmann
@ 2022-03-14 15:40 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2022-03-14 15:40 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: marcel, johan.hedberg, luiz.dentz, hildawu, apusaka,
	linux-bluetooth, linux-kernel, syzbot+b9bd12fbed3485a3e51f

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:

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: syzbot+b9bd12fbed3485a3e51f@syzkaller.appspotmail.com
> Fixes: d9dd833cf6d2 ("Bluetooth: hci_h5: Add runtime suspend")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-14 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 17:49 [PATCH] Bluetooth: hci_uart: add missing NULL check in h5_enqueue Pavel Skripkin
2022-03-13 19:04 ` bluez.test.bot
2022-03-14 15:34 ` [PATCH] " Marcel Holtmann
2022-03-14 15:40 ` patchwork-bot+bluetooth

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.