From: sashiko-bot@kernel.org
To: "Denis Benato" <denis.benato@linux.dev>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v4 03/13] HID: asus: add support for ROG Ally handhelds
Date: Sun, 30 Aug 2026 23:56:09 +0000 [thread overview]
Message-ID: <20260830235609.8CB091F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260830234320.114356-4-denis.benato@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Devres LIFO ordering violation causing a use-after-free during device removal.
--
commit 6c026e410beeb5bf25ebf0d772fc59dc024dc875
Author: Denis Benato <denis.benato@linux.dev>
HID: asus: add support for ROG Ally handhelds
Implement the core functionality for ASUS handhelds, extending the functionality
of hid-asus if the driver is enabled. This initializes the device, implements
Ally X input mapping, and emits a single proper event for AC button long press.
> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c
[ ... ]
> +static void ally_x_input_close(struct input_dev *dev)
> +{
> + hid_hw_close(input_get_drvdata(dev));
> +}
> +
> +static struct input_dev *ally_x_alloc_input_dev(struct hid_device *hdev)
> +{
> + struct input_dev *input_dev = devm_input_allocate_device(&hdev->dev);
[ ... ]
> + input_dev->open = ally_x_input_open;
> + input_dev->close = ally_x_input_close;
> +
> + return input_dev;
> +}
[ ... ]
> @@ -1570,6 +2481,9 @@ static void asus_remove(struct hid_device *hdev)
> if (drvdata->listener.brightness_set)
> asus_hid_unregister_listener(&drvdata->listener);
>
> + if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD)
> + hid_asus_ally_remove(hdev, drvdata->rog_ally);
> +
> asus_worker_stop(drvdata->worker);
> hid_hw_stop(hdev);
> }
[Severity: High]
Does this manual call to hid_hw_stop() conflict with the devres-managed input
device teardown?
Since ally_x_alloc_input_dev() allocates the input device using
devm_input_allocate_device(), its unregistration is deferred until after
this remove() callback finishes.
If userspace has an open file descriptor on the gamepad device when the
device is unplugged or unbound, the devres-triggered input_unregister_device()
will call the input device's .close callback, which was set to
ally_x_input_close():
ally_x_input_close()
hid_hw_close(input_get_drvdata(dev));
Because hid_hw_stop() has already been executed here in asus_remove(), the
transport resources have been destroyed. When ally_x_input_close() drops into
the transport driver via hid_hw_close(), it will try to access those freed
resources, leading to a use-after-free.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260830234320.114356-1-denis.benato@linux.dev?part=3
next prev parent reply other threads:[~2026-08-30 23:56 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 23:43 [PATCH v4 00/13] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-30 23:43 ` [PATCH v4 01/13] HID: asus: do not send keyboard init reports to touchpads Denis Benato
2026-08-30 23:43 ` [PATCH v4 02/13] HID: asus: reinitialize the device after exiting a sleep state Denis Benato
2026-08-30 23:43 ` [PATCH v4 03/13] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-30 23:56 ` sashiko-bot [this message]
2026-08-30 23:43 ` [PATCH v4 04/13] HID: asus: add gamepad configuration Denis Benato
2026-08-30 23:53 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 05/13] HID: asus: add vibration strength configuration Denis Benato
2026-08-30 23:43 ` [PATCH v4 06/13] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-08-31 0:05 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 07/13] HID: asus: add triggers " Denis Benato
2026-08-30 23:58 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 08/13] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-08-30 23:57 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 09/13] HID: asus: add support for response curve Denis Benato
2026-08-31 0:03 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 10/13] HID: asus: add support to force feedback Denis Benato
2026-08-31 0:02 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 11/13] HID: asus: add support for gamepad mode Denis Benato
2026-08-31 0:05 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 12/13] HID: asus: add support for turbo buttons Denis Benato
2026-08-31 0:14 ` sashiko-bot
2026-08-30 23:43 ` [PATCH v4 13/13] HID: asus: add support for btn remapping Denis Benato
2026-08-31 0:08 ` 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=20260830235609.8CB091F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=denis.benato@linux.dev \
--cc=dmitry.torokhov@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