All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pawel Zalewski (The Capable Hub)" <pzalewski@thegoodpenguin.co.uk>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v3 8/8] HID: wacom: do not use 'driver_data'
Date: Mon, 27 Jul 2026 15:18:15 +0000	[thread overview]
Message-ID: <20260727151816.2A2C61F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260727-mod-devicetable-hid_device_id-v3-8-980896ca283e@thegoodpenguin.co.uk>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Critical] Removal of driver_data breaks dynamic device binding via sysfs 'new_id', preventing testing of unknown/clone devices.

Pre-existing issues:
- [High] Missing cancellation of `wacom->init_work` on the error path for wireless monitors leads to a UAF.
--

--- Patch [8]: [PATCH v3 8/8] HID: wacom: do not use 'driver_data' ---
commit 147dba29dc34be167b7150ce20799c7b7dd39442
Author: Pawel Zalewski (The Capable Hub) <pzalewski@thegoodpenguin.co.uk>

HID: wacom: do not use 'driver_data'

This patch removes the use of driver_data for looking up product features in
the wacom driver. It instead looks up wacom_features directly by product ID
to reduce macro complexity and simplify the code.

[ ... ]

> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 834519751a5cf..4514b2762cc33 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -2848,7 +2845,7 @@ static int wacom_probe(struct hid_device *hdev,
>  
>  	wacom_wac = &wacom->wacom_wac;
>  
> -	const struct wacom_features *id_features = get_wacom_features(id->driver_data);
> +	const struct wacom_features *id_features = get_wacom_features(id->product);

[Severity: Critical]
Does removing driver_data introduce a regression for dynamic device binding
via sysfs 'new_id'?

By strictly using get_wacom_features(id->product), the mechanism for injecting
unknown product IDs seems rendered unusable because the injected PID won't match
any entry in the static wacom_features_table. Previously, couldn't users pass a
feature table index via driver_data to test unknown or clone devices?

[Severity: High]
This is a pre-existing issue, but is there a missing cancellation of 
wacom->init_work on the error path for wireless monitors?

drivers/hid/wacom_sys.c:wacom_parse_and_register() {
    ...
	if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
		error = hid_hw_open(hdev);
		if (error) {
			hid_err(hdev, "hw open failed\n");
			goto fail_hw_stop;
		}
	}
    ...
}

In wacom_parse_and_register(), wacom_query_tablet_data() schedules
wacom->init_work. If hid_hw_open() subsequently fails for a wireless monitor
(WACOM_DEVICETYPE_WL_MONITOR), the error path jumps to fail_hw_stop and
returns without calling cancel_delayed_work_sync(&wacom->init_work).

Because the wacom structure is managed by devres and will be freed upon probe
failure, could this result in a use-after-free when init_work executes later?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-mod-devicetable-hid_device_id-v3-0-980896ca283e@thegoodpenguin.co.uk?part=8

      reply	other threads:[~2026-07-27 15:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 14:55 [PATCH v3 0/8] HID: storing pointers in 'hid_device_id::driver_data' Pawel Zalewski (The Capable Hub)
2026-07-27 14:55 ` [PATCH v3 1/8] HID: hid-input: use named initializer for 'hid_battery_quirks[]' Pawel Zalewski (The Capable Hub)
2026-07-27 14:55 ` [PATCH v3 2/8] HID: hid-quirks: use named initializer in 'hid_quirks[]' Pawel Zalewski (The Capable Hub)
2026-07-27 14:55 ` [PATCH v3 3/8] HID: hid-asus: use named initializer for 'asus_devices[]' Pawel Zalewski (The Capable Hub)
2026-07-27 14:55 ` [PATCH v3 4/8] HID: i2c-hid-dmi-quirks: use named initializer for 'i2c_hid_elan_flipped_quirks[]' Pawel Zalewski (The Capable Hub)
2026-07-27 14:55 ` [PATCH v3 5/8] HID: hid-tmff: clean up usage of 'driver_data' Pawel Zalewski (The Capable Hub)
2026-07-27 15:08   ` sashiko-bot
2026-07-27 14:55 ` [PATCH v3 6/8] HID: wacom: cleanup " Pawel Zalewski (The Capable Hub)
2026-07-27 15:11   ` sashiko-bot
2026-07-27 14:55 ` [PATCH v3 7/8] HID: hid-core: sanitize user input in 'new_id_store' Pawel Zalewski (The Capable Hub)
2026-07-27 15:08   ` sashiko-bot
2026-07-27 14:55 ` [PATCH v3 8/8] HID: wacom: do not use 'driver_data' Pawel Zalewski (The Capable Hub)
2026-07-27 15:18   ` sashiko-bot [this message]

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=20260727151816.2A2C61F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=pzalewski@thegoodpenguin.co.uk \
    --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 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.