* [PATCH v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
@ 2026-07-01 16:06 Weiming Shi
2026-07-01 16:51 ` [v2] " bluez.test.bot
2026-07-02 16:10 ` [PATCH v2] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Weiming Shi @ 2026-07-01 16:06 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: Johan Hedberg, linux-bluetooth, linux-kernel, Weiming Shi,
Xiang Mei
bpa10x_setup() sends the vendor command 0xfc0e and passes the response
to bt_dev_info() and hci_set_fw_info() as a "%s" string starting at
skb->data + 1, without checking the length:
bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
hci_set_fw_info(hdev, "%s", skb->data + 1);
A device that returns a one-byte response (status only) leaves
skb->data + 1 past the end of the data, and the %s walk reads adjacent
slab memory until it meets a NUL. The same happens when the payload is
not NUL-terminated within skb->len. The out-of-bounds bytes end up in
the kernel log and the firmware-info debugfs file.
Print the revision string with a bounded "%.*s" limited to skb->len - 1
instead. This keeps the string readable for well-behaved devices while
never reading past the received data, and does not fail setup, so a
device returning a short or unterminated response keeps working.
Fixes: ddd68ec8f484 ("Bluetooth: bpa10x: Read revision information in setup stage")
Reported-by: Xiang Mei <xmei5@asu.edu>
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
---
v2: use bounded "%.*s" instead of failing setup with -EILSEQ (Pauli)
drivers/bluetooth/bpa10x.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 2ae38a321c4b..e63d1af250ec 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -255,9 +255,13 @@ static int bpa10x_setup(struct hci_dev *hdev)
if (IS_ERR(skb))
return PTR_ERR(skb);
- bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
+ /* Bounded print: the device controls skb->len. */
+ if (skb->len > 1) {
+ int len = skb->len - 1;
- hci_set_fw_info(hdev, "%s", skb->data + 1);
+ bt_dev_info(hdev, "%.*s", len, (char *)(skb->data + 1));
+ hci_set_fw_info(hdev, "%.*s", len, skb->data + 1);
+ }
kfree_skb(skb);
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
2026-07-01 16:06 [PATCH v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup() Weiming Shi
@ 2026-07-01 16:51 ` bluez.test.bot
2026-07-02 16:10 ` [PATCH v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-07-01 16:51 UTC (permalink / raw)
To: linux-bluetooth, bestswngs
[-- Attachment #1: Type: text/plain, Size: 2314 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=1119978
---Test result---
Test Summary:
CheckPatch FAIL 0.72 seconds
VerifyFixes PASS 0.13 seconds
VerifySignedoff PASS 0.13 seconds
GitLint FAIL 0.33 seconds
SubjectPrefix PASS 0.12 seconds
BuildKernel PASS 26.88 seconds
CheckAllWarning PASS 29.51 seconds
CheckSparse PASS 28.62 seconds
BuildKernel32 PASS 25.87 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 502.45 seconds
IncrementalBuild PASS 25.39 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#121:
Reported-by: Xiang Mei <xmei5@asu.edu>
Assisted-by: Claude:claude-opus-4-8
total: 0 errors, 1 warnings, 15 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/patch/14657103.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
7: B3 Line contains hard tab characters (\t): " bt_dev_info(hdev, "%s", (char *)(skb->data + 1));"
8: B3 Line contains hard tab characters (\t): " hci_set_fw_info(hdev, "%s", skb->data + 1);"
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/383
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
2026-07-01 16:06 [PATCH v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup() Weiming Shi
2026-07-01 16:51 ` [v2] " bluez.test.bot
@ 2026-07-02 16:10 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-07-02 16:10 UTC (permalink / raw)
To: Weiming Shi
Cc: marcel, luiz.dentz, johan.hedberg, linux-bluetooth, linux-kernel,
xmei5
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 1 Jul 2026 09:06:14 -0700 you wrote:
> bpa10x_setup() sends the vendor command 0xfc0e and passes the response
> to bt_dev_info() and hci_set_fw_info() as a "%s" string starting at
> skb->data + 1, without checking the length:
>
> bt_dev_info(hdev, "%s", (char *)(skb->data + 1));
> hci_set_fw_info(hdev, "%s", skb->data + 1);
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup()
https://git.kernel.org/bluetooth/bluetooth-next/c/6042a966e047
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-02 16:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 16:06 [PATCH v2] Bluetooth: bpa10x: avoid OOB read of revision string in bpa10x_setup() Weiming Shi
2026-07-01 16:51 ` [v2] " bluez.test.bot
2026-07-02 16:10 ` [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