Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btintel: Fix insufficient skb length check in btintel_print_fseq_info()
@ 2026-05-14 16:49 Quan Sun
  2026-05-14 17:35 ` Luiz Augusto von Dentz
  2026-05-14 18:47 ` bluez.test.bot
  0 siblings, 2 replies; 4+ messages in thread
From: Quan Sun @ 2026-05-14 16:49 UTC (permalink / raw)
  To: linux-bluetooth, kiran.k, luiz.dentz, marcel; +Cc: Quan Sun

The length check at the top of btintel_print_fseq_info() verifies
that the skb has at least 66 bytes (sizeof(u32) * 16 + 2), but the
function actually consumes 74 bytes:

  2 calls to skb_pull_data(skb, 1)  =  2 bytes
  18 calls to skb_pull_data(skb, 4) = 72 bytes

When the firmware returns a packet of exactly 66 bytes, the last two
skb_pull_data(skb, 4) calls return NULL, which is then passed directly
to get_unaligned_le32(), resulting in a NULL pointer dereference.

Fix the length check to account for all 74 bytes actually consumed:
  sizeof(u32) * 16 + 2  ->  sizeof(u32) * 18 + 2

Fixes: a7ba218a44aa ("Bluetooth: btintel: Print Firmware Sequencer information")
Signed-off-by: Quan Sun <2022090917019@std.uestc.edu.cn>
---
 drivers/bluetooth/btintel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index dcaaa4ca02b99..114a8beeab92d 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -3356,7 +3356,7 @@ void btintel_print_fseq_info(struct hci_dev *hdev)
 		return;
 	}
 
-	if (skb->len < (sizeof(u32) * 16 + 2)) {
+	if (skb->len < (sizeof(u32) * 18 + 2)) {
 		bt_dev_dbg(hdev, "Malformed packet of length %u received",
 			   skb->len);
 		kfree_skb(skb);
-- 
2.43.0


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

end of thread, other threads:[~2026-05-14 18:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 16:49 [PATCH] Bluetooth: btintel: Fix insufficient skb length check in btintel_print_fseq_info() Quan Sun
2026-05-14 17:35 ` Luiz Augusto von Dentz
2026-05-14 18:10   ` Quan Sun
2026-05-14 18:47 ` bluez.test.bot

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