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 v8 09/12] HID: asus: add support to force feedback
Date: Tue, 22 Sep 2026 23:15:13 +0000	[thread overview]
Message-ID: <20260922231513.B0D561F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922230205.6847-10-denis.benato@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] hid: asus: UAF in usbhid_output_report due to race in ally_x_setup_input error path
--

commit 8ccfbfaa682d3590de29005dd9112219250dde2e
Author: Denis Benato <denis.benato@linux.dev>

    HID: asus: add support to force feedback

This commit adds force feedback support to the ROG Ally X gamepad interface.
It implements a work-queue based approach for sending FF_RUMBLE packets as
output reports to avoid sleeping calls in atomic context.

> diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c
> index bb664bd9e140b..a8ecc95f2db1f 100644
> --- a/drivers/hid/hid-asus.c
> +++ b/drivers/hid/hid-asus.c

[ ... ]

> @@ -2845,6 +2845,11 @@ static int ally_x_setup_input(struct hid_device *hdev, struct ally_handheld *all
>  
>  	return 0;
>  ally_x_setup_input_err:
> +	spin_lock_irqsave(&ally_data_lock, flags);
> +	if (ally->ally_x_hdev == hdev)
> +		ally->ally_x_hdev = NULL;
> +	spin_unlock_irqrestore(&ally_data_lock, flags);
> +

[Severity: High]
Does unpublishing ally_x_hdev here without acquiring intf_mutex break
serialization with hid_asus_ally_init()?

If the CFG interface probes concurrently with the Gamepad interface, and the
Gamepad probe fails at input_register_device(), this error path unpublishes
ally_x_hdev without holding intf_mutex.

Could hid_asus_ally_init() concurrently snapshot the gamepad hdev before it
is unpublished, and subsequently call ally_x_send_ff_off()?

Meanwhile, the Gamepad probe returns an error, prompting the HID core to call
hid_hw_stop() on the gamepad interface. hid_hw_stop() calls usbhid_stop(),
which frees the urbout pointer.

Could ally_x_send_ff_off() then call hid_hw_output_report() on the stopped
transport, racing with the free of the urbout pointer and causing a
use-after-free?

>  	input_free_device(input);
>  	return ret;
>  }

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

  reply	other threads:[~2026-09-22 23:15 UTC|newest]

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