Skip to content

HID: core: fix __hid_request when no report ID is used

Benjamin Tissoires linux-input linux-kselftest linux-usb lkml stable 2 versions – Applied

Status from this message: Applied to hid/hid.git (for-6.16/upstream-fixes), thanks!

Get series with b4
b4 am [email protected] change-id 20250709-report-size-null-37619ea20288

Versions newest first

  1. v2 Latest4 patches 3 repliesApplied
  2. v13 patches 1 replySuperseded

Changes in v2 from the cover letter

- added Tested-by from syzbot (https://lore.kernel.org/r/[email protected])
- added a python test for it
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4HID: core: ensure the allocated report buffer can contain the reserved report IDdrivers/hid/hid-core.c+4 -10 replies
2/4HID: core: ensure __hid_request reserves the report ID as the first bytedrivers/hid/hid-core.c+9 -20 replies
3/4HID: core: do not bypass hid_hw_raw_requestdrivers/hid/hid-core.c+1 -20 replies
4/4selftests/hid: add a test case for the recent syzbot underflowtools/testing/selftests/hid/tests/test_mouse.py+70 -02 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

Patch[email protected]
1/4
2/4T-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] HID: core: fix __hid_request when no report ID is used

New version (unchanged for patches 1-3), with a test added so we can detect this.

Followup of https://lore.kernel.org/linux-input/[email protected]/

This initial series attempt at fixing the various bugs discovered by Alan regarding __hid_request().

Syzbot managed to create a report descriptor which presents a feature request of size 0 (still trying to extract it) and this exposed the fact that __hid_request() was incorrectly handling the case when the report ID is not used.

Send a first batch of fixes now so we get the feedback from syzbot ASAP.

Note: in the series, I also mentioned that the report of size 0 should be stripped out of the HID device, but I'm not entirely sure this would be a good idea in the end.

---
Changes in v2:
- added Tested-by from syzbot (https://lore.kernel.org/r/[email protected])
- added a python test for it
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Benjamin Tissoires (4):
HID: core: ensure the allocated report buffer can contain the reserved report ID
HID: core: ensure __hid_request reserves the report ID as the first byte
HID: core: do not bypass hid_hw_raw_request
selftests/hid: add a test case for the recent syzbot underflow

 drivers/hid/hid-core.c                          | 19 +++++--
 tools/testing/selftests/hid/tests/test_mouse.py | 70 +++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 5 deletions(-)

---
base-commit: 1f988d0788f50d8464f957e793fab356e2937369
change-id: 20250709-report-size-null-37619ea20288

Best regards,

Signature · 1 line
Benjamin Tissoires <[email protected]>