Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jinmo Yang" <jinmo44.yang@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 2/5] HID: wacom: check the input devices in the legacy irq handlers
Date: Sun, 18 Oct 2026 10:53:29 +0000	[thread overview]
Message-ID: <sashiko-outbox-176060@kernel.org> (raw)
In-Reply-To: <20261018104617.743771-3-jinmo44.yang@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] HID: wacom: requiring pad_input in wacom_dtus_irq() breaks DTUSX pen input
--

commit 1918eedc787a6887650a12d8f1032a28643191fc
Author: Jinmo Yang <jinmo44.yang@gmail.com>

HID: wacom: check the input devices in the legacy irq handlers

This commit adds NULL checks for wacom->pen_input and wacom->pad_input at
the entry of six legacy Wacom interrupt handlers to prevent NULL pointer
dereferences when an interface only initializes a subset of the input
devices.

> diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
> index 567b01882eb1e..aa08afb3c5ef0 100644
> --- a/drivers/hid/wacom_wac.c
> +++ b/drivers/hid/wacom_wac.c

[ ... ]

> @@ -293,6 +317,13 @@ static int wacom_dtus_irq(struct wacom_wac *wacom)
>  	struct input_dev *input = wacom->pen_input;
>  	unsigned short prox, pressure = 0;
>  
> +	if (!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;
> +	}

[Severity: High]
Does requiring wacom->pad_input at the start of wacom_dtus_irq() break pen
input on Wacom DTU-1031X (DTUSX) tablets?

In drivers/hid/wacom_wac.c, wacom_wac_irq() dispatches both DTUS and DTUSX
devices to wacom_dtus_irq():

	case DTUS:
	case DTUSX:
		sync = wacom_dtus_irq(wacom_wac);
		break;

Unlike DTUS tablets, the Wacom DTU-1031X (wacom_features_0x32F, with type
DTUSX) is pen-only and has 0 numbered buttons:

static const struct wacom_features wacom_features_0x32F =
	{ "Wacom DTU1031X", 22672, 12928, 511, 0,
	  DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0,
	  WACOM_DTU_OFFSET, WACOM_DTU_OFFSET,
	  WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };

During probe, wacom_setup_device_quirks() only sets WACOM_DEVICETYPE_PAD
for DTUS, not DTUSX:

	if (features->type == GRAPHIRE_BT || features->type == WACOM_G4 ||
	    features->type == DTUS ||
	    (features->type >= INTUOS3S && features->type <= WACOM_MO)) {
		if (features->device_type & WACOM_DEVICETYPE_PEN)
			features->device_type |= WACOM_DEVICETYPE_PAD;
	}

And wacom_setup_pad_input_capabilities() returns -ENODEV for DTUSX, which
causes wacom_setup_inputs() to free pad_input and leave wacom->pad_input
as NULL.

When WACOM_REPORT_DTUS pen reports arrive from a DTUSX tablet, won't this
new check always trigger and drop all pen events? Should wacom->pad_input
only be required when features->type != DTUSX (with a check in the
WACOM_REPORT_DTUSPAD branch), or checked specifically when handling
WACOM_REPORT_DTUSPAD reports?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261018104617.743771-1-jinmo44.yang@gmail.com?part=2

  reply	other threads:[~2026-10-18 10:53 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 [this message]
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-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=sashiko-outbox-176060@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jinmo44.yang@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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