[PATCH v5 0/6] HID: wacom: guard against NULL input devices on successful probe
From: Jinmo Yang
Date: Sun Nov 22 2026 - 23:21:13 EST
When wacom_setup_{pen,touch,pad}_input_capabilities() returns -ENODEV,
the corresponding input pointer is set to NULL but probe still succeeds.
Subsequent irq handlers dereference those pointers unconditionally,
causing NULL-pointer dereferences reachable from a spoofed HID device.
This series adds per-function NULL guards across all affected handlers.
v4 was generated against a tree that predates commit 2f985de0afbe
("HID: wacom: fix wacom_intuos_irq NULL pen_input deref"), so patch 3/6
no longer applied and was dropped. This respin is against
hid.git#for-7.4/upstream-fixes (10bc1d627c29).
Jason's Reviewed-by from v4 is carried on the five patches that are
unchanged. It is not carried on 3/6, which was reworked.
Changes in v5:
- Rebased onto hid.git#for-7.4/upstream-fixes (Jiri).
- Reworked 3/6. Commit 2f985de0afbe removed the 'input' local and the
dev_dbg(input->dev.parent, ...) deref from wacom_intuos_irq(), so the
pen_input guard there now exists solely to protect
wacom_intuos_inout() and wacom_intuos_general(), which are its only
callers. The guard therefore reads wacom_wac->pen_input and uses the
struct wacom that 2f985de0afbe made a local, and it now sits below
the pad block rather than at the top of the function, so a device
with a valid pad but no pen keeps reporting pad events.
- No functional change to 1/6, 2/6, 4/6, 5/6 or 6/6.
Changes in v4:
- wacom_intuos_pad() now returns 2 for the normal path, 1 for the
NULL-guard path; wacom_intuos_irq() applies "result - 1" uniformly,
suppressing the spurious input_sync() the old "return 1" would
trigger (Jason).
- Added pen_input NULL guard at the top of wacom_intuos_irq() to
protect its helpers wacom_intuos_inout() and
wacom_intuos_general() (Jason).
- Added pen_input NULL guard to wacom_bpt_pen() (Jason).
Changes in v3:
- Fixed wacom_dtus_irq(): DTUSX is pen-only, so do not require
pad_input for it (sashiko-bot).
- Added patch 6: touch_input guards for wacom_intuos_pro2_bt_touch(),
wacom_24hdt_irq(), and wacom_bamboo_pad_touch_event().
Changes in v2:
- Restructured per Jason's review: per-function checks for dtus_irq,
graphire_irq, and the Bamboo handlers.
- wacom_intuos_pad() returns non-zero when pad_input is NULL so the
report does not fall through to wacom_intuos_inout() (sashiko-bot).
- wacom_intuos_bt_irq() guards both pen_input and pad_input (Jason).
- Added dev_warn_once at every guard (Jason).
- Dropped the cp2112 patch (Benjamin prefers Dmitry's series).
Jinmo Yang (6):
HID: wacom: check the input device in the shared report helpers
HID: wacom: check the input devices in the legacy irq handlers
HID: wacom: add NULL input guards to wacom_intuos_irq() and its
helpers
HID: wacom: add NULL input guards to wacom_intuos_bt_irq()
HID: wacom: add NULL input guards to Bamboo handlers
HID: wacom: add NULL touch_input guards to remaining touch handlers
drivers/hid/wacom_wac.c | 127 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 122 insertions(+), 5 deletions(-)
base-commit: 10bc1d627c297097cfdc099377f8a13efdfffd86
--
2.43.0