public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: HIDP: reject oversized report descriptor
@ 2026-02-25  1:35 Eric-Terminal
  2026-02-25  4:25 ` bluez.test.bot
  2026-02-27 15:04 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 8+ messages in thread
From: Eric-Terminal @ 2026-02-25  1:35 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, ericterminal

From: Yufan Chen <ericterminal@gmail.com>

hidp_setup_hid() duplicates the report descriptor from userspace
based on req->rd_size. hidp_session_dev_init() only checked
rd_size > 0, so oversized values were accepted and propagated
to memdup_user().

Reject values larger than HID_MAX_DESCRIPTOR_SIZE and return
-EINVAL before entering the HID setup path.

Signed-off-by: Yufan Chen <ericterminal@gmail.com>
---
 net/bluetooth/hidp/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 6fe815241..ce68b3c27 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -815,6 +815,9 @@ static int hidp_session_dev_init(struct hidp_session *session,
 {
 	int ret;
 
+	if (req->rd_size > HID_MAX_DESCRIPTOR_SIZE)
+		return -EINVAL;
+
 	if (req->rd_size > 0) {
 		ret = hidp_setup_hid(session, req);
 		if (ret && ret != -ENODEV)
-- 
2.53.0


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

end of thread, other threads:[~2026-03-22 15:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25  1:35 [PATCH] Bluetooth: HIDP: reject oversized report descriptor Eric-Terminal
2026-02-25  4:25 ` bluez.test.bot
2026-02-27 15:04 ` [PATCH] " Luiz Augusto von Dentz
2026-02-28 17:26   ` [PATCH v2] Bluetooth: HIDP: cap report descriptor size in HID setup Eric-Terminal
2026-02-28 18:06     ` [v2] " bluez.test.bot
2026-03-01  9:19     ` [PATCH v2] " Bastien Nocera
2026-03-11 10:18       ` Benjamin Tissoires
2026-03-22 15:37         ` Eric_Terminal

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