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>,
Claude Opus 5 <noreply@anthropic.com>
Subject: [PATCH v5 3/6] HID: wacom: add NULL input guards to wacom_intuos_irq() and its helpers
Date: Mon, 23 Nov 2026 04:20:12 +0000 [thread overview]
Message-ID: <27712cb2096f247d723284ab0c59da2ecf4f0146.1795405057.git.jinmo44.yang@gmail.com> (raw)
In-Reply-To: <cover.1795405057.git.jinmo44.yang@gmail.com>
Since commit 2f985de0afbe ("HID: wacom: fix wacom_intuos_irq NULL
pen_input deref"), wacom_intuos_irq() no longer dereferences pen_input
itself. Its helpers wacom_intuos_inout() and wacom_intuos_general()
still do, unconditionally: each takes wacom->pen_input into a local and
calls input_report_*() on it. pen_input can be NULL when
wacom_setup_pen_input_capabilities() returns -ENODEV during a successful
probe. Both helpers are called only from wacom_intuos_irq(), so guard
them there, after the pad block so that a device with a valid pad but no
pen keeps reporting pad events.
wacom_intuos_pad() uses pad_input throughout, but pad_input can be NULL
when wacom_setup_pad_input_capabilities() returns -ENODEV during a
successful probe. Add a NULL guard after the report-ID check.
Adopt the same return convention as wacom_intuos_inout() and
wacom_intuos_general(): return 1 for "handled, don't sync" and 2 for
"handled, sync". Update wacom_intuos_irq() to apply the matching
"result - 1" transform so that the NULL-guard path (return 1) suppresses
the spurious input_sync() that the old "return 1" would have triggered
via wacom_wac_irq().
Fixes: 10059cdc0ad0 ("Input: wacom - split out the pad device for Intuos/Cintiq")
Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---
drivers/hid/wacom_wac.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index d5c2efcc09b8..b162f40397be 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -581,6 +581,12 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
data[0] == WACOM_REPORT_CINTIQPAD))
return 0;
+ if (!input) {
+ dev_warn_once(&container_of(wacom, struct wacom, wacom_wac)->hdev->dev,
+ "%s: pad_input is NULL\n", __func__);
+ return 1; /* handled; the -1 in wacom_intuos_irq() suppresses sync */
+ }
+
if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
buttons = (data[3] << 1) | (data[2] & 0x01);
ring1 = data[1];
@@ -716,7 +722,7 @@ static int wacom_intuos_pad(struct wacom_wac *wacom)
input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
- return 1;
+ return 2;
}
static int wacom_intuos_id_mangle(int tool_id)
@@ -1089,7 +1095,13 @@ static int wacom_intuos_irq(struct wacom_wac *wacom_wac)
/* process pad events */
result = wacom_intuos_pad(wacom_wac);
if (result)
- return result;
+ return result - 1;
+
+ if (!wacom_wac->pen_input) {
+ dev_warn_once(&wacom->hdev->dev,
+ "%s: pen_input is NULL\n", __func__);
+ return 0;
+ }
/* process in/out prox events */
result = wacom_intuos_inout(wacom_wac);
--
2.43.0
next prev parent reply other threads:[~2026-11-23 4:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 4:20 [PATCH v5 0/6] HID: wacom: guard against NULL input devices on successful probe Jinmo Yang
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 ` Jinmo Yang [this message]
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=27712cb2096f247d723284ab0c59da2ecf4f0146.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=noreply@anthropic.com \
--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®