All of lore.kernel.org
 help / color / mirror / Atom feed
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, stable@vger.kernel.org,
	Jinmo Yang <jinmo44.yang@gmail.com>,
	"Claude Opus 4.6" <noreply@anthropic.com>
Subject: [PATCH v3 3/6] HID: wacom: add NULL pad_input guard to wacom_intuos_pad()
Date: Sun, 18 Oct 2026 21:47:52 +0900	[thread overview]
Message-ID: <20261018124755.850888-4-jinmo44.yang@gmail.com> (raw)
In-Reply-To: <20261018124755.850888-1-jinmo44.yang@gmail.com>

wacom_intuos_pad() uses wacom->pad_input throughout, but pad_input can
be NULL when wacom_setup_pad_input_capabilities() returns -ENODEV during
a successful probe.

Place the guard after the data[0] report-ID check and return 1 so the
report is consumed. Returning 0 would let the caller fall through to
wacom_intuos_inout(), which would misparse the pad packet as a pen
event.

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 4.6 <noreply@anthropic.com>
---
 drivers/hid/wacom_wac.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index bec8dbec5bc3..65829de86363 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; /* consume the report to prevent fall-through */
+	}
+
 	if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
 		buttons = (data[3] << 1) | (data[2] & 0x01);
 		ring1 = data[1];
-- 
2.53.0


  parent reply	other threads:[~2026-10-18 12:48 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 15:01 [PATCH] HID: wacom: fix NULL pointer dereference in wacom_intuos_pad() Jinmo Yang
2026-05-23 15:06 ` [PATCH v2] " Jinmo Yang
2026-05-23 15:50   ` sashiko-bot
2026-05-29 21:44   ` Dmitry Torokhov
2026-06-10 15:48     ` Jiri Kosina
2026-09-26 18:37       ` Jinmo Yang
2026-09-27  4:11       ` [PATCH 0/5] HID: wacom: check input devices in the report handlers Jinmo Yang
2026-09-27  4:11         ` [PATCH 1/5] HID: wacom: check the input device in the shared report helpers Jinmo Yang
2026-10-17  0:05           ` Jason Gerecke
2026-09-27  4:11         ` [PATCH 2/5] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
2026-10-17  0:05           ` Jason Gerecke
2026-09-27  4:11         ` [PATCH 3/5] HID: wacom: check the input device in wacom_intuos_pad() Jinmo Yang
2026-09-27  4:24           ` sashiko-bot
2026-10-17  0:05           ` Jason Gerecke
2026-09-27  4:11         ` [PATCH 4/5] HID: wacom: check the input device in wacom_intuos_bt_irq() Jinmo Yang
2026-10-17  0:05           ` Jason Gerecke
2026-09-27  4:11         ` [PATCH 5/5] HID: wacom: check the input devices in the Bamboo handlers Jinmo Yang
2026-10-17  0:05           ` Jason Gerecke
2026-10-16  9:27         ` [PATCH 0/5] HID: wacom: check input devices in the report handlers Jiri Kosina
2026-10-17  0:05         ` Jason Gerecke
2026-10-18 10:46         ` [PATCH v2 0/5] HID: wacom: guard against NULL input devices on successful probe Jinmo Yang
2026-10-18 10:46           ` [PATCH v2 1/5] HID: wacom: check the input device in the shared report helpers Jinmo Yang
2026-10-18 11:00             ` sashiko-bot
2026-10-18 10:46           ` [PATCH v2 2/5] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
2026-10-18 10:53             ` sashiko-bot
2026-10-18 10:46           ` [PATCH v2 3/5] HID: wacom: add NULL pad_input guard to wacom_intuos_pad() Jinmo Yang
2026-10-18 10:46           ` [PATCH v2 4/5] HID: wacom: add NULL input guards to wacom_intuos_bt_irq() Jinmo Yang
2026-10-18 10:46           ` [PATCH v2 5/5] HID: wacom: add NULL input guards to Bamboo touch/button handlers Jinmo Yang
2026-10-18 12:47         ` [PATCH v3 0/6] HID: wacom: guard against NULL input devices on successful probe Jinmo Yang
2026-10-18 12:47           ` [PATCH v3 1/6] HID: wacom: check the input device in the shared report helpers Jinmo Yang
2026-10-18 12:47           ` [PATCH v3 2/6] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
2026-10-18 12:47           ` Jinmo Yang [this message]
2026-10-18 12:47           ` [PATCH v3 4/6] HID: wacom: add NULL input guards to wacom_intuos_bt_irq() Jinmo Yang
2026-10-18 12:47           ` [PATCH v3 5/6] HID: wacom: add NULL input guards to Bamboo touch/button handlers Jinmo Yang
2026-10-18 12:47           ` [PATCH v3 6/6] HID: wacom: add NULL touch_input guards to remaining touch handlers Jinmo Yang
2026-05-23 15:45 ` [PATCH] HID: wacom: fix NULL pointer dereference in wacom_intuos_pad() sashiko-bot

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=20261018124755.850888-4-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 \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.