Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: btusb: validate Realtek vendor event length
@ 2026-07-20 11:47 Pengpeng Hou
  2026-07-20 12:33 ` [v2] " bluez.test.bot
  2026-07-20 20:20 ` [PATCH v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-07-20 11:47 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: Paul Menzel, linux-bluetooth, linux-kernel, Pengpeng Hou

btusb_recv_event_realtek() reads the event code at data[0] and the Realtek
subevent code at data[2] before deciding whether to consume a vendor event
as a coredump.

For example, the two-byte event ff 00 contains a complete vendor-event
header declaring zero parameters. The old classifier still reads a
nonexistent third byte and can misclassify the event as a coredump if the
adjacent byte is 0x34.

Require the HCI event header and first parameter to be present before
inspecting the Realtek subevent code. Short events continue through the
normal HCI receive path, which owns their protocol validation.

Fixes: 044014ce85a1 ("Bluetooth: btrtl: Add Realtek devcoredump support")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
Changes since v1: https://lore.kernel.org/all/20260706091618.77442-1-pengpeng@iscas.ac.cn/
- clarify both fixed-offset reads and add a concrete short event
- add the requested Fixes tag
- rebase onto v7.2-rc4

 drivers/bluetooth/btusb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 08c0a99a62c5..8f7ed469cac6 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2782,7 +2782,9 @@ static int btusb_setup_realtek(struct hci_dev *hdev)
 
 static int btusb_recv_event_realtek(struct hci_dev *hdev, struct sk_buff *skb)
 {
-	if (skb->data[0] == HCI_VENDOR_PKT && skb->data[2] == RTK_SUB_EVENT_CODE_COREDUMP) {
+	if (skb->len >= HCI_EVENT_HDR_SIZE + 1 &&
+	    skb->data[0] == HCI_VENDOR_PKT &&
+	    skb->data[2] == RTK_SUB_EVENT_CODE_COREDUMP) {
 		struct rtk_dev_coredump_hdr hdr = {
 			.code = RTK_DEVCOREDUMP_CODE_MEMDUMP,
 		};


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

* RE: [v2] Bluetooth: btusb: validate Realtek vendor event length
  2026-07-20 11:47 [PATCH v2] Bluetooth: btusb: validate Realtek vendor event length Pengpeng Hou
@ 2026-07-20 12:33 ` bluez.test.bot
  2026-07-20 20:20 ` [PATCH v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-07-20 12:33 UTC (permalink / raw)
  To: linux-bluetooth, pengpeng

[-- Attachment #1: Type: text/plain, Size: 1181 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=1130844

---Test result---

Test Summary:
CheckPatch                    PASS      0.71 seconds
VerifyFixes                   PASS      0.12 seconds
VerifySignedoff               PASS      0.12 seconds
GitLint                       PASS      0.31 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      26.03 seconds
CheckAllWarning               PASS      29.79 seconds
CheckSparse                   PASS      27.74 seconds
BuildKernel32                 PASS      24.87 seconds
CheckKernelLLVM               SKIP      0.00 seconds
TestRunnerSetup               PASS      469.33 seconds
IncrementalBuild              PASS      29.93 seconds

Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found


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

---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2] Bluetooth: btusb: validate Realtek vendor event length
  2026-07-20 11:47 [PATCH v2] Bluetooth: btusb: validate Realtek vendor event length Pengpeng Hou
  2026-07-20 12:33 ` [v2] " bluez.test.bot
@ 2026-07-20 20:20 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-07-20 20:20 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: marcel, luiz.dentz, pmenzel, linux-bluetooth, linux-kernel

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon, 20 Jul 2026 19:47:17 +0800 you wrote:
> btusb_recv_event_realtek() reads the event code at data[0] and the Realtek
> subevent code at data[2] before deciding whether to consume a vendor event
> as a coredump.
> 
> For example, the two-byte event ff 00 contains a complete vendor-event
> header declaring zero parameters. The old classifier still reads a
> nonexistent third byte and can misclassify the event as a coredump if the
> adjacent byte is 0x34.
> 
> [...]

Here is the summary with links:
  - [v2] Bluetooth: btusb: validate Realtek vendor event length
    https://git.kernel.org/bluetooth/bluetooth-next/c/891916abe16f

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] 3+ messages in thread

end of thread, other threads:[~2026-07-20 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-20 11:47 [PATCH v2] Bluetooth: btusb: validate Realtek vendor event length Pengpeng Hou
2026-07-20 12:33 ` [v2] " bluez.test.bot
2026-07-20 20:20 ` [PATCH v2] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox