Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vicki Pfau" <vi@endrift.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v4 2/6] HID: steam: Initial 2026 Steam Controller support
Date: Fri, 07 Aug 2026 23:59:21 +0000	[thread overview]
Message-ID: <20260807235922.185D71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807232339.2799205-3-vi@endrift.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Use-After-Free (UAF) of the `steam` struct due to uncancelled delayed works when asynchronous registration fails.
--

--- Patch [2]: [PATCH v4 2/6] HID: steam: Initial 2026 Steam Controller support ---
commit 1d87ff75b79e456dee7ec00f38dd2bafa9555a17
Author: Vicki Pfau <vi@endrift.com>

HID: steam: Initial 2026 Steam Controller support

This brings support for the 2026 Steam Controller, comparably featureful to
the existing support for the Steam Deck.

> diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
> index 5deeff2db266e..ec7ccbe5aba09 100644
> --- a/drivers/hid/hid-steam.c
> +++ b/drivers/hid/hid-steam.c

[ ... ]

> @@ -1210,7 +1440,6 @@ static void steam_unregister(struct steam_device *steam)
>  	mutex_lock(&steam_devices_lock);
>  	list_del_init(&steam->list);
>  	mutex_unlock(&steam_devices_lock);
> -	steam->serial_no[0] = 0;
>  }

[Severity: High]
Can this result in a use-after-free of the steam struct?

If a controller connects asynchronously and steam_register() is called,
it registers the input device. If a subsequent step like
steam_sensors_register() fails, the error path is taken:

drivers/hid/hid-steam.c:steam_register() {
...
	ret = steam_sensors_register(steam);
	if (ret != 0)
		goto steam_register_sensors_fail;

	steam->registered = true;
...
steam_register_sensors_fail:
	steam_input_unregister(steam);
...
}

Because steam->registered is never set to true, any delayed works scheduled
during the brief window the input device was active (such as mode_switch
or rumble_work) might still be pending.

Later, when the device is removed, steam_unregister() is called but
returns early without canceling those works:

drivers/hid/hid-steam.c:steam_unregister() {
	if (!steam->registered)
		return;
...
}

When devres frees the steam struct at the end of steam_remove(), wouldn't
the still-pending works execute and access freed memory?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807232339.2799205-1-vi@endrift.com?part=2

  reply	other threads:[~2026-08-07 23:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 23:23 [PATCH v4 0/6] HID: steam: Add 2026 Steam Controller support Vicki Pfau
2026-08-07 23:23 ` [PATCH v4 1/6] HID: steam: Refactor registration Vicki Pfau
2026-08-07 23:36   ` sashiko-bot
2026-08-07 23:23 ` [PATCH v4 2/6] HID: steam: Initial 2026 Steam Controller support Vicki Pfau
2026-08-07 23:59   ` sashiko-bot [this message]
2026-08-07 23:23 ` [PATCH v4 3/6] HID: steam: Fix wording of connect/disconnect logs Vicki Pfau
2026-08-07 23:23 ` [PATCH v4 4/6] HID: steam: Don't set feature reports when disconnecting Vicki Pfau
2026-08-07 23:48   ` sashiko-bot
2026-08-07 23:23 ` [PATCH v4 5/6] HID: steam: Clean up locking Vicki Pfau
2026-08-07 23:53   ` sashiko-bot
2026-08-07 23:23 ` [PATCH v4 6/6] HID: steam: Zero out inputs when disabling gamepad mode Vicki Pfau

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=20260807235922.185D71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vi@endrift.com \
    /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