Linux Input/HID development
 help / color / mirror / Atom feed
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 v3 03/12] HID: asus: add gamepad configuration
Date: Sun, 23 Aug 2026 19:15:22 +0000	[thread overview]
Message-ID: <20260823191523.415921F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260823185849.2478673-4-denis.benato@linux.dev>

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

Pre-existing issues:
- [High] Invalid cast of parent device to usb_interface or usb_device without checking hid_is_usb().
--

--- Patch [3]: [PATCH v3 03/12] HID: asus: add gamepad configuration ---
commit f281ed94708b0871557c0870cec3173a2e3fa823
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: add gamepad configuration

Add the base configuration structures for the gamepad configuration,
detect capabilities and initialize the device in a known state.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index 048bc902323ab..04f41294edf67 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c

[ ... ]

> @@ -964,6 +1254,7 @@ static struct ally_handheld *hid_asus_ally_probe(struct hid_device *hdev)
>  	unsigned long flags;
>  	int ret, ep = ally_get_endpoint_address(hdev);
>  	struct usb_device *udev;
> +	struct ally_config *ally_cfg;
>  	struct hid_input *hidinput;
>  
>  	if (ep < 0)

[Severity: High]
This is a pre-existing issue, but in hid_asus_ally_probe() in
drivers/hid/hid-asus.c, there is an unsafe cast of the parent device to a
usb_interface and usb_device without first verifying the transport.

If a userspace process creates a virtual device via /dev/uhid with the Asus
ROG Ally vendor and product IDs, the HID core binds this driver, assigns the
QUIRK_ROG_ALLY_XPAD quirk, and calls hid_asus_ally_probe() in asus_probe():

    if (drvdata->quirks & QUIRK_ROG_ALLY_XPAD) {
        ally = hid_asus_ally_probe(hdev);

Since the transport is not verified with hid_is_usb(hdev), the driver
blindly casts the uhid parent device to struct usb_interface:

    udev = interface_to_usbdev(to_usb_interface(hdev->dev.parent));

This results in garbage pointers being passed to usb_get_dev(udev), which
can immediately panic the kernel or lead to a use-after-free or out-of-bounds
access. This is reachable by any unprivileged userspace process that has
access to /dev/uhid, allowing for a local denial of service.

Should this code check hid_is_usb(hdev) before making USB-specific casts?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260823185849.2478673-1-denis.benato@linux.dev?part=3

  reply	other threads:[~2026-08-23 19:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 18:58 [PATCH v3 00/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-23 18:58 ` [PATCH v3 01/12] HID: asus: reinitialize the device after exiting a sleep state Denis Benato
2026-08-23 18:58 ` [PATCH v3 02/12] HID: asus: add support for ROG Ally handhelds Denis Benato
2026-08-23 19:10   ` sashiko-bot
2026-08-23 18:58 ` [PATCH v3 03/12] HID: asus: add gamepad configuration Denis Benato
2026-08-23 19:15   ` sashiko-bot [this message]
2026-08-23 18:58 ` [PATCH v3 04/12] HID: asus: add vibration strength configuration Denis Benato
2026-08-23 19:17   ` sashiko-bot
2026-08-23 18:58 ` [PATCH v3 05/12] HID: asus: add joysticks inner and outer range configuration Denis Benato
2026-08-23 18:58 ` [PATCH v3 06/12] HID: asus: add triggers " Denis Benato
2026-08-23 18:58 ` [PATCH v3 07/12] HID: asus: add joysticks anti-deadzone configuration Denis Benato
2026-08-23 18:58 ` [PATCH v3 08/12] HID: asus: add support for response curve Denis Benato
2026-08-23 18:58 ` [PATCH v3 09/12] HID: asus: add support to force feedback Denis Benato
2026-08-23 19:14   ` sashiko-bot
2026-08-23 18:58 ` [PATCH v3 10/12] HID: asus: add support for gamepad mode Denis Benato
2026-08-23 18:58 ` [PATCH v3 11/12] HID: asus: add support for turbo buttons Denis Benato
2026-08-23 18:58 ` [PATCH v3 12/12] HID: asus: add support for btn remapping Denis Benato

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=20260823191523.415921F000E9@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