* [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak
@ 2026-09-19 22:17 Hui Peng
2026-09-21 15:11 ` krzk
2026-09-21 15:16 ` krzk
0 siblings, 2 replies; 3+ messages in thread
From: Hui Peng @ 2026-09-19 22:17 UTC (permalink / raw)
To: marcel, luiz.dentz; +Cc: linux-bluetooth, linux-kernel
In hidp_recv_intr_frame() and hidp_recv_ctrl_frame()
(net/bluetooth/hidp/core.c), check skb->len >= 1 with pskb_may_pull()
before dereferencing skb->data[0] and skb_pull(skb, 1), and free any
stale session->report_return skb before overwriting it or when tearing
down the HIDP session.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@gmail.com>
---
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index f5bdf9f1ca63..7fc1b3ae585f 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -321,6 +321,8 @@ static int hidp_get_raw_report(struct hid_device *hid,
err:
clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags);
+ kfree_skb(session->report_return);
+ session->report_return = NULL;
mutex_unlock(&session->report_mutex);
return ret;
}
@@ -520,6 +522,9 @@ static int hidp_process_data(struct hidp_session *session, struct sk_buff *skb,
int done_with_skb = 1;
BT_DBG("session %p skb %p len %u param 0x%02x", session, skb, skb->len, param);
+ if (skb->len < 1)
+ return 1;
+
switch (param) {
case HIDP_DATA_RTYPE_INPUT:
hidp_set_timer(session);
@@ -548,6 +553,7 @@ static int hidp_process_data(struct hidp_session *session, struct sk_buff *skb,
(skb->len &&
session->waiting_report_number == skb->data[0])) {
/* hidp_get_raw_report() is waiting on this report. */
+ kfree_skb(session->report_return);
session->report_return = skb;
done_with_skb = 0;
clear_bit(HIDP_WAITING_FOR_RETURN, &session->flags);
@@ -615,7 +621,7 @@ static void hidp_recv_intr_frame(struct hidp_session *session,
if (session->input)
hidp_input_report(session, skb);
- if (session->hid) {
+ if (session->hid && skb->len >= 1) {
hidp_process_report(session, HID_INPUT_REPORT,
skb->data, skb->len, 1);
BT_DBG("report len %d", skb->len);
@@ -1000,6 +1006,7 @@ static void session_free(struct kref *ref)
hidp_session_dev_destroy(session);
skb_queue_purge(&session->ctrl_transmit);
skb_queue_purge(&session->intr_transmit);
+ kfree_skb(session->report_return);
fput(session->intr_sock->file);
fput(session->ctrl_sock->file);
if (session->conn)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak
2026-09-19 22:17 [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak Hui Peng
@ 2026-09-21 15:11 ` krzk
2026-09-21 15:16 ` krzk
1 sibling, 0 replies; 3+ messages in thread
From: krzk @ 2026-09-21 15:11 UTC (permalink / raw)
To: Hui Peng; +Cc: marcel, luiz.dentz, linux-kernel, linux-bluetooth
On Sat, 19 Sep 2026 22:17:41 +0000, Hui Peng wrote:
> In hidp_recv_intr_frame() and hidp_recv_ctrl_frame()
> (net/bluetooth/hidp/core.c), check skb->len >= 1 with pskb_may_pull()
> before dereferencing skb->data[0] and skb_pull(skb, 1), and free any
> stale session->report_return skb before overwriting it or when tearing
> down the HIDP session.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem, how to document usage of LLM and how what you should not
do if this was posted in a good faith.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak
2026-09-19 22:17 [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak Hui Peng
2026-09-21 15:11 ` krzk
@ 2026-09-21 15:16 ` krzk
1 sibling, 0 replies; 3+ messages in thread
From: krzk @ 2026-09-21 15:16 UTC (permalink / raw)
To: Hui Peng; +Cc: linux-kernel, marcel, luiz.dentz, linux-bluetooth
On Sat, 19 Sep 2026 22:17:41 +0000, Hui Peng wrote:
> In hidp_recv_intr_frame() and hidp_recv_ctrl_frame()
> (net/bluetooth/hidp/core.c), check skb->len >= 1 with pskb_may_pull()
> before dereferencing skb->data[0] and skb_pull(skb, 1), and free any
> stale session->report_return skb before overwriting it or when tearing
> down the HIDP session.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Assisted-by: LLM
> Signed-off-by: Hui Peng <benquike@gmail.com>
> ---
You sent multiple independent patches, to multiple independent
subsystems. The amount of these patches clearly suggest this was
AI generated and most likely not tested.
More importantly, you sent all this work without properly organizing
relevant patches into patchsets. This makes reviewing difficult
and might cause multiple reviewers to address the same issue.
Replying to the entire set is impossible and requires handling each
patch independently, instead of applying or discarding the set.
Maintainers also won't see the bigger picture of your work. Quite
worrying.
This is on the verge of hostile patch: bomb us with so many
contributions, we won't be able to handle them in efficient manner,
like responding ONCE to ask you to slow down. Considering all this
is untested and LLM generated, I have even more doubts whether this
should be considered for review.
Please read kernel documentation BEFORE posting more work. It will
explain you how to identify subsystems, how to organize your work per
subsystem, how to document usage of LLM and how what you should not
do if this was posted in a good faith.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-21 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-19 22:17 [PATCH] Bluetooth: hidp: fix out-of-bounds reads on short frames and report_return skb leak Hui Peng
2026-09-21 15:11 ` krzk
2026-09-21 15:16 ` krzk
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®