[PATCH v3 6/6] HID: wacom: add NULL touch_input guards to remaining touch handlers

From: Jinmo Yang

Date: Sun Oct 18 2026 - 08:50:56 EST


wacom_24hdt_irq() (also handles WACOM_27QHDT), wacom_intuos_pro2_bt_touch(),
and wacom_bamboo_pad_touch_event() dereference wacom->touch_input without
checking it.

As with the other handlers in this series, touch_input can be NULL when
wacom_setup_touch_input_capabilities() returns -ENODEV during an
otherwise successful probe.

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

diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index a34db1505625..e3fff2471d43 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1483,6 +1483,12 @@ static void wacom_intuos_pro2_bt_touch(struct wacom_wac *wacom)
int num_contacts_left = 5;
int i, j;

+ if (!touch_input) {
+ dev_warn_once(&container_of(wacom, struct wacom, wacom_wac)->hdev->dev,
+ "%s: touch_input is NULL\n", __func__);
+ return;
+ }
+
for (i = 0; i < finger_frames; i++) {
unsigned char *frame = &data[i*finger_frame_len + 109];
int current_num_contacts = frame[0] & 0x7F;
@@ -1654,6 +1660,12 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET;
int y_offset = 2;

+ if (!input) {
+ dev_warn_once(&container_of(wacom, struct wacom, wacom_wac)->hdev->dev,
+ "%s: touch_input is NULL\n", __func__);
+ return 0;
+ }
+
if (touch_is_muted(wacom) && !wacom->shared->touch_down)
return 0;

@@ -3418,6 +3430,12 @@ static int wacom_bamboo_pad_touch_event(struct wacom_wac *wacom,
int x, y;
bool valid;

+ if (!input) {
+ dev_warn_once(&container_of(wacom, struct wacom, wacom_wac)->hdev->dev,
+ "%s: touch_input is NULL\n", __func__);
+ return 0;
+ }
+
prefix = data[0];

for (id = 0; id < wacom->features.touch_max; id++) {
--
2.53.0