* [PATCH] Bluetooth: btintel: Bound exception info print to the received length
@ 2026-08-14 8:01 Ali Ahmet Memis
2026-08-14 9:36 ` Paul Menzel
0 siblings, 1 reply; 2+ messages in thread
From: Ali Ahmet Memis @ 2026-08-14 8:01 UTC (permalink / raw)
To: marcel, luiz.dentz; +Cc: johan.hedberg, linux-bluetooth, linux-kernel
btintel_hw_error() validates that the Intel exception info response is
exactly 13 bytes, and then prints the 12 bytes following the status byte
with a plain "%s". Nothing validates that those 12 bytes contain a NUL,
so the conversion can run past the end of the received response and into
whatever follows it in the skb.
Bound the conversion to the length that was actually received.
Fixes: 973bb97e5aee ("Bluetooth: btintel: Add generic function for handling hardware errors")
Signed-off-by: Ali Ahmet Memis <ali@iusegentoo.com>
---
drivers/bluetooth/btintel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index bf567b7c5f00..4112f39f251f 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -288,7 +288,9 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code)
goto unlock;
}
- bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1));
+ /* The exception info field is not guaranteed to be NUL terminated */
+ bt_dev_err(hdev, "Exception info %.*s", (int)(skb->len - 1),
+ (char *)(skb->data + 1));
kfree_skb(skb);
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Bluetooth: btintel: Bound exception info print to the received length
2026-08-14 8:01 [PATCH] Bluetooth: btintel: Bound exception info print to the received length Ali Ahmet Memis
@ 2026-08-14 9:36 ` Paul Menzel
0 siblings, 0 replies; 2+ messages in thread
From: Paul Menzel @ 2026-08-14 9:36 UTC (permalink / raw)
To: Ali Ahmet Memis
Cc: marcel, luiz.dentz, johan.hedberg, linux-bluetooth, linux-kernel
Dear Ali,
Thank you for your patch.
Am 14.08.26 um 10:01 schrieb Ali Ahmet Memis:
> btintel_hw_error() validates that the Intel exception info response is
> exactly 13 bytes, and then prints the 12 bytes following the status byte
> with a plain "%s". Nothing validates that those 12 bytes contain a NUL,
> so the conversion can run past the end of the received response and into
> whatever follows it in the skb.
>
> Bound the conversion to the length that was actually received.
>
> Fixes: 973bb97e5aee ("Bluetooth: btintel: Add generic function for handling hardware errors")
> Signed-off-by: Ali Ahmet Memis <ali@iusegentoo.com>
> ---
> drivers/bluetooth/btintel.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> index bf567b7c5f00..4112f39f251f 100644
> --- a/drivers/bluetooth/btintel.c
> +++ b/drivers/bluetooth/btintel.c
> @@ -288,7 +288,9 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code)
> goto unlock;
> }
>
> - bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1));
> + /* The exception info field is not guaranteed to be NUL terminated */
> + bt_dev_err(hdev, "Exception info %.*s", (int)(skb->len - 1),
> + (char *)(skb->data + 1));
>
> kfree_skb(skb);
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
PS: gemini/gemini-3.1-pro-preview found also other occurrences [1].
[1]:
https://sashiko.dev/#/patchset/20260814080123.902388-1-ali%40iusegentoo.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-14 9:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-14 8:01 [PATCH] Bluetooth: btintel: Bound exception info print to the received length Ali Ahmet Memis
2026-08-14 9:36 ` Paul Menzel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®