All of lore.kernel.org
 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 02/12] HID: asus: add support for ROG Ally handhelds
Date: Sun, 23 Aug 2026 19:10:29 +0000	[thread overview]
Message-ID: <20260823191030.4BCDC1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260823185849.2478673-3-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing endpoint count validation leads to an Out-Of-Bounds read on malformed USB devices.
--

--- Patch [2]: [PATCH v3 02/12] HID: asus: add support for ROG Ally handhelds ---
commit 361cb3e0d7ac3fa396f12b80e08c07137d346210
Author: Denis Benato <denis.benato@linux.dev>

HID: asus: add support for ROG Ally handhelds

This commit adds support for ASUS ROG Ally handhelds. It extends the 
hid-asus driver to initialize the device to a ready state, implements 
Ally X input mapping, and manages specific handheld features.

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

[ ... ]

> +static int ally_get_endpoint_address(struct hid_device *hdev)
> +{
> +	struct usb_host_endpoint *ep;
> +	struct usb_interface *intf;
> +
> +	if (!hid_is_usb(hdev))
> +		return -ENODEV;
> +
> +	intf = to_usb_interface(hdev->dev.parent);
> +	if (!intf || !intf->cur_altsetting)
> +		return -ENODEV;
> +
> +	ep = intf->cur_altsetting->endpoint;
> +	if (!ep)
> +		return -ENODEV;
> +
> +	return ep->desc.bEndpointAddress;

[Severity: High]
Does this code miss a check for the number of endpoints?

If a malformed USB device provides an interface with 0 endpoints
(where bNumEndpoints == 0), the endpoint array could be empty. Accessing
ep->desc.bEndpointAddress (which is essentially endpoint[0].desc) could
then result in an out-of-bounds read or a kernel panic when syzkaller or a
malicious peripheral interacts with the system.

Should this function verify that intf->cur_altsetting->desc.bNumEndpoints > 0
before attempting to access the endpoint structure?

> +}

[ ... ]

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

  reply	other threads:[~2026-08-23 19:10 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 [this message]
2026-08-23 18:58 ` [PATCH v3 03/12] HID: asus: add gamepad configuration Denis Benato
2026-08-23 19:15   ` sashiko-bot
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=20260823191030.4BCDC1F000E9@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 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.