From: sashiko-bot@kernel.org
To: "Aamir Ahmed" <elb12345@hotmail.co.uk>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH] HID: wacom: Cancel init_work when probe fails after scheduling it
Date: Sat, 05 Sep 2026 22:09:12 +0000 [thread overview]
Message-ID: <20260905220912.AC1711F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <PAXP251MB001050EFD88752318EBA75F5C8B42@PAXP251MB0010.EURP251.PROD.OUTLOOK.COM>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Uncancelled background workers and timers in the wacom_parse_and_register() error path lead to UAF when called outside of probe().
--
commit 611f293eb48407c71bbdfd98b12f13ec53358ab0
Author: Aamir Ahmed <elb12345@hotmail.co.uk>
HID: wacom: Cancel init_work when probe fails after scheduling it
This commit cancels init_work on the shared error path in
wacom_parse_and_register() to prevent a use-after-free when probe fails
and devres cleans up driver resources.
Closes: https://lore.kernel.org/linux-input/20260905102908.ADE1F1F00A3D@smtp.kernel.org/
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 0eafa483b7f75..ba8adefd93266 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
[ ... ]
> @@ -2501,6 +2501,7 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
>
> fail_hw_stop:
> hid_hw_stop(hdev);
> + cancel_delayed_work_sync(&wacom->init_work);
> fail:
> wacom_release_resources(wacom);
> return error;
[Severity: High]
This is a pre-existing issue, but can this error path still result in a
use-after-free if it is reached outside of probe()?
The commit message notes that reports cannot reach the driver during probe
because driver_input_lock is held, preventing other work items from being
scheduled.
However, looking at wacom_wireless_work() and wacom_mode_change_work(),
they also call wacom_parse_and_register(). In these workqueue contexts,
driver_input_lock is not held.
Once hid_hw_start() is called earlier in this function, could incoming
reports immediately schedule asynchronous tasks like remote_work,
battery_work, and aes_battery_work?
If a subsequent step like hid_hw_open() fails, execution jumps to
fail_hw_stop. While init_work is cancelled here, the other background
tasks are not.
Will wacom_release_resources() then free the devres group containing
wacom->remote and other structures, leaving those uncancelled tasks to
execute and access freed memory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/PAXP251MB001050EFD88752318EBA75F5C8B42@PAXP251MB0010.EURP251.PROD.OUTLOOK.COM?part=1
prev parent reply other threads:[~2026-09-05 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 21:56 [PATCH] HID: wacom: Cancel init_work when probe fails after scheduling it Aamir Ahmed
2026-09-05 22:09 ` 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=20260905220912.AC1711F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=elb12345@hotmail.co.uk \
--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