From: Jinmo Yang <jinmo44.yang@gmail.com>
To: ping.cheng@wacom.com, jason.gerecke@wacom.com, jikos@kernel.org,
bentiss@kernel.org
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Jinmo Yang <jinmo44.yang@gmail.com>
Subject: [PATCH v5 0/6] HID: wacom: guard against NULL input devices on successful probe
Date: Mon, 23 Nov 2026 04:20:09 +0000 [thread overview]
Message-ID: <cover.1795405057.git.jinmo44.yang@gmail.com> (raw)
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
next reply other threads:[~2026-11-23 4:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 4:20 Jinmo Yang [this message]
2026-11-23 4:20 ` [PATCH v5 1/6] HID: wacom: check the input device in the shared report helpers Jinmo Yang
2026-11-23 4:20 ` [PATCH v5 2/6] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
2026-11-23 4:20 ` [PATCH v5 3/6] HID: wacom: add NULL input guards to wacom_intuos_irq() and its helpers Jinmo Yang
2026-11-23 4:20 ` [PATCH v5 4/6] HID: wacom: add NULL input guards to wacom_intuos_bt_irq() Jinmo Yang
2026-11-23 4:20 ` [PATCH v5 5/6] HID: wacom: add NULL input guards to Bamboo handlers Jinmo Yang
2026-11-23 4:20 ` [PATCH v5 6/6] HID: wacom: add NULL touch_input guards to remaining touch handlers Jinmo Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1795405057.git.jinmo44.yang@gmail.com \
--to=jinmo44.yang@gmail.com \
--cc=bentiss@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=jason.gerecke@wacom.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ping.cheng@wacom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®