Skip to content

HID: wacom: add report length validation in irq handlers

Jinmo Yang linux-input lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4HID: wacom: validate report length for PL and PTU handlersdrivers/hid/wacom_wac.c+4 -00 replies
2/4HID: wacom: validate report length for DTU handlerdrivers/hid/wacom_wac.c+2 -00 replies
3/4HID: wacom: validate report length for DTUS handlerdrivers/hid/wacom_wac.c+2 -00 replies
4/4HID: wacom: validate report length for 24HDT and 27QHDT handlersdrivers/hid/wacom_wac.c+7 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] HID: wacom: add report length validation in irq handlers

Several wacom IRQ handler sub-functions access fixed offsets in the raw HID report buffer without validating the buffer length. wacom_wac_irq() receives the length from wacom_raw_event() but does not validate it before dispatching to the sub-functions, which do not receive the length parameter.

A malicious USB device can declare a small HID report in its descriptor and send a matching short report that passes the HID core size check (csize >= rsize), but the driver assumes a full-size hardware report layout, leading to slab-out-of-bounds reads.

Note: this is not mitigated by the recent HID core bounds checking series which validates actual_size >= declared_size. An attacker controls both the descriptor (declared size) and the sent data (actual size), so the core check passes. Driver-level validation against the expected hardware report layout is still necessary.

Tested with KASAN on Linux 7.1-rc3 (slab-out-of-bounds confirmed) and verified kernel panic on a production device via uhid.

Jinmo Yang (4):
HID: wacom: validate report length for PL and PTU handlers
HID: wacom: validate report length for DTU handler
HID: wacom: validate report length for DTUS handler
HID: wacom: validate report length for 24HDT and 27QHDT handlers

 drivers/hid/wacom_wac.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Signature · 1 line
2.53.0