Linux kernel -stable discussions
 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>
Subject: [PATCH v4 4/6] HID: wacom: add NULL input guards to wacom_intuos_bt_irq()
Date: Sat, 24 Oct 2026 12:30:38 +0900	[thread overview]
Message-ID: <20261024033040.316652-5-jinmo44.yang@gmail.com> (raw)
In-Reply-To: <20261024033040.316652-1-jinmo44.yang@gmail.com>

wacom_intuos_bt_irq() dereferences wacom->pen_input in every switch
branch, both directly for dev_warn/dev_dbg and indirectly through
wacom_intuos_bt_process_data() which calls input_sync(pen_input).
pad_input is also used in wacom_intuos_bt_process_data().

Both can be NULL when the corresponding setup_*_input_capabilities()
returns -ENODEV during a successful probe. For INTUOS4WL, pen and pad
are always expected together, so guard both at function entry.

Fixes: 2a6cdbdd4cc0 ("HID: wacom: Introduce new 'touch_input' device")
Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---
 drivers/hid/wacom_wac.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index c38fbec114e4..6e2e67abf80e 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1269,6 +1269,13 @@ static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len)
 	int i = 1;
 	unsigned power_raw, battery_capacity, bat_charging, ps_connected;
 
+	if (!wacom->pen_input || !wacom->pad_input) {
+		dev_warn_once(&container_of(wacom, struct wacom, wacom_wac)->hdev->dev,
+			      "%s: expected pen and pad input devices\n",
+			      __func__);
+		return 0;
+	}
+
 	switch (data[0]) {
 	case 0x04:
 		if (len < 32) {
-- 
2.53.0


  parent reply	other threads:[~2026-10-24  3:30 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <579o8so3-09o3-o312-4sq0-0qp6n672q46p@xreary.bet>
     [not found] ` <20260927041138.4112920-1-jinmo44.yang@gmail.com>
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-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-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 10:46     ` [PATCH v2 2/5] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
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     ` [PATCH v3 3/6] HID: wacom: add NULL pad_input guard to wacom_intuos_pad() Jinmo Yang
2026-10-21 18:57       ` Jason Gerecke
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-21 18:57       ` Jason Gerecke
2026-10-18 12:47     ` [PATCH v3 6/6] HID: wacom: add NULL touch_input guards to remaining touch handlers Jinmo Yang
2026-10-24  3:30   ` [PATCH v4 0/6] HID: wacom: guard against NULL input devices on successful probe Jinmo Yang
2026-10-24  3:30     ` [PATCH v4 1/6] HID: wacom: check the input device in the shared report helpers Jinmo Yang
2026-10-24  3:30     ` [PATCH v4 2/6] HID: wacom: check the input devices in the legacy irq handlers Jinmo Yang
2026-10-24  3:30     ` [PATCH v4 3/6] HID: wacom: add NULL input guards to wacom_intuos_irq() and its helpers Jinmo Yang
2026-10-24  3:30     ` Jinmo Yang [this message]
2026-10-24  3:30     ` [PATCH v4 5/6] HID: wacom: add NULL input guards to Bamboo handlers Jinmo Yang
2026-10-24  3:30     ` [PATCH v4 6/6] HID: wacom: add NULL touch_input guards to remaining touch handlers Jinmo Yang
2026-11-02 21:32     ` [PATCH v4 0/6] HID: wacom: guard against NULL input devices on successful probe Jason Gerecke

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=20261024033040.316652-5-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 \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox