All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: HIDP: add missing length check for incoming frames
@ 2026-07-17 15:32 Jiale Yao
  2026-07-17 15:40 ` Luiz Augusto von Dentz
  2026-07-17 16:23 ` bluez.test.bot
  0 siblings, 2 replies; 8+ messages in thread
From: Jiale Yao @ 2026-07-17 15:32 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Jiale Yao, Tim Bird,
	Muhammad Bilal, Kees Cook, Michael Bommarito, linux-bluetooth,
	linux-kernel

In hidp_recv_ctrl_frame() and hidp_recv_intr_frame(), skb->data[0] is
read without verifying that skb->len >= 1.  A zero-length L2CAP PDU
delivered via the HIDP control or interrupt channel causes an
out-of-bounds read.

Add pskb_may_pull(skb, 1) guards before both reads, matching the fix
in commit 6770d3a8acdf ("Bluetooth: bnep: reject short frames before
parsing") which addressed the same class of bug in BNEP.

Assisted-by: Claude:deepseek-v4-pro
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 net/bluetooth/hidp/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 0e24c5e2955e..6c7da8aca732 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -565,6 +565,8 @@ static void hidp_recv_ctrl_frame(struct hidp_session *session,
 
 	BT_DBG("session %p skb %p len %u", session, skb, skb->len);
 
+	if (!pskb_may_pull(skb, 1))
+		return;
 	hdr = skb->data[0];
 	skb_pull(skb, 1);
 
@@ -601,6 +603,8 @@ static void hidp_recv_intr_frame(struct hidp_session *session,
 
 	BT_DBG("session %p skb %p len %u", session, skb, skb->len);
 
+	if (!pskb_may_pull(skb, 1))
+		return;
 	hdr = skb->data[0];
 	skb_pull(skb, 1);
 
-- 
2.34.1


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

end of thread, other threads:[~2026-08-14  4:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 15:32 [PATCH] Bluetooth: HIDP: add missing length check for incoming frames Jiale Yao
2026-07-17 15:40 ` Luiz Augusto von Dentz
2026-07-19  5:37   ` Re:Re: [PATCH v2] " jiale yao
2026-07-20 19:47     ` Luiz Augusto von Dentz
2026-07-21  5:54       ` Re:Re: Re: [PATCH v3] " jiale yao
2026-07-22  0:06         ` Muhammad Bilal
2026-08-14  4:27     ` Re:Re: [PATCH v2] " kernel test robot
2026-07-17 16:23 ` bluez.test.bot

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.