HID: wacom: guard against NULL input devices on successful probe
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest6 patches 0 repliesNew
- v46 patches 3 repliesSuperseded
- v36 patches 2 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 5 patches | 0 replies | Superseded | |
| v1 | 5 patches | 7 replies | Superseded |
Changes in v5 from the cover letter
- 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.
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | HID: wacom: check the input device in the shared report helpersdrivers/ | +14 | 0 replies | |
| 2/6 | HID: wacom: check the input devices in the legacy irq handlersdrivers/ | +40 | 0 replies | |
| 3/6 | HID: wacom: add NULL input guards to wacom_intuos_irq() and its helpersdrivers/ | +14 | 0 replies | |
| 4/6 | HID: wacom: add NULL input guards to wacom_intuos_bt_irq()drivers/ | +7 | 0 replies | |
| 5/6 | HID: wacom: add NULL input guards to Bamboo handlersdrivers/ | +29 | 0 replies | |
| 6/6 | HID: wacom: add NULL touch_input guards to remaining touch handlersdrivers/ | +18 | 0 replies |
Reviews trailers per patch
5 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Jason Gerecke | Claude Opus 4.6 |
|---|---|---|
| 1/6 | R-b | |
| 2/6 | R-b | Co-Authored-By |
| 3/6 | Co-Authored-By | |
| 4/6 | R-b | Co-Authored-By |
| 5/6 | R-b | Co-Authored-By |
| 6/6 | R-b | Co-Authored-By |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 0/6] HID: wacom: guard against NULL input devices on successful probe
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
Signature · 1 line
2.43.0