From: sashiko-bot@kernel.org
To: "Vicki Pfau" <vi@endrift.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v4 09/11] HID: steam: Improve logging and other cleanup
Date: Wed, 29 Jul 2026 02:11:23 +0000 [thread overview]
Message-ID: <20260729021123.DEC851F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729015243.1170573-10-vi@endrift.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The error path in `steam_register()` fails to remove the device from the global `steam_devices` list, leading to a Use-After-Free when probe fails.
--
--- Patch [9]: [PATCH v4 09/11] HID: steam: Improve logging and other cleanup ---
commit e2534775e852c76ea14b6b8605e36139ce7654b1
Author: Vicki Pfau <vi@endrift.com>
HID: steam: Improve logging and other cleanup
Adds more logging as appropriate, reindents an enum to match surrounding
style, as well as cleaning up some places where we can use guard() instead
of doing locking and unlocking manually.
> diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
> index 5ab4396a241e0..3738a4de3bffb 100644
> --- a/drivers/hid/hid-steam.c
> +++ b/drivers/hid/hid-steam.c
[ ... ]
> @@ -1838,6 +1847,7 @@ static void steam_do_deck_input_event(struct steam_device *steam,
> steam->did_mode_switch = false;
> cancel_delayed_work(&steam->mode_switch);
> } else if (!steam->client_opened && start_pressed && !steam->did_mode_switch) {
> + hid_dbg(steam->hdev, "%s: doing mode switch\n", __func__);
> steam->did_mode_switch = true;
> schedule_delayed_work(&steam->mode_switch, 45 * HZ / 100);
> }
[Severity: High]
This is a pre-existing issue, but the error path in steam_register() fails to
remove the device from the global steam_devices list, which could lead to a
use-after-free when probe fails.
If steam_register() fails during steam_probe() for a wired device (e.g., if
steam_sensors_register() returns an error), the steam object is added to the
global steam_devices list but is not removed on the error path:
drivers/hid/hid-steam.c:steam_register() {
...
steam_register_sensors_fail:
steam_input_unregister(steam);
steam_register_input_fail:
return ret;
}
steam_probe() then returns the error, jumping to the err_hw_stop label and
bypassing steam_unregister(), which would have removed it from the list:
drivers/hid/hid-steam.c:steam_probe() {
...
ret = steam_register(steam);
if (ret) {
hid_err(hdev, "%s:steam_register failed with error %d\n", __func__, ret);
goto err_hw_stop;
}
...
}
Because the steam object was allocated with devm_kzalloc(), the kernel frees
it upon probe failure, leaving a dangling pointer in the steam_devices list.
Can this memory corruption be triggered by plugging in a second Steam
Controller, or by writing to the lizard_mode sysfs parameter?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260729015243.1170573-1-vi@endrift.com?part=9
next prev parent reply other threads:[~2026-07-29 2:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 1:52 [PATCH v4 00/10] HID: steam: General cleanup and improvements Vicki Pfau
2026-07-29 1:52 ` [PATCH v4 01/11] HID: steam: Update documentation Vicki Pfau
2026-07-29 1:52 ` [PATCH v4 02/11] HID: steam: Refactor and clean up report parsing Vicki Pfau
2026-07-29 1:52 ` [PATCH v4 03/11] HID: steam: Rename some constants that got renamed upstream Vicki Pfau
2026-07-29 1:52 ` [PATCH v4 04/11] HID: steam: Zero-initialize reply in serial lookup Vicki Pfau
2026-07-29 2:10 ` sashiko-bot
2026-07-29 1:52 ` [PATCH v4 05/11] HID: steam: Add support for sensor events on the Steam Controller (2015) Vicki Pfau
2026-07-29 2:09 ` sashiko-bot
2026-07-29 1:52 ` [PATCH v4 06/11] HID: steam: Coalesce rumble packets Vicki Pfau
2026-07-29 2:13 ` sashiko-bot
2026-07-29 1:52 ` [PATCH v4 07/11] HID: steam: Fully unregister controller when hidraw is opened Vicki Pfau
2026-07-29 2:12 ` sashiko-bot
2026-07-29 1:52 ` [PATCH v4 08/11] HID: steam: Rearrange teardown sequence Vicki Pfau
2026-07-29 2:15 ` sashiko-bot
2026-07-29 1:52 ` [PATCH v4 09/11] HID: steam: Improve logging and other cleanup Vicki Pfau
2026-07-29 2:11 ` sashiko-bot [this message]
2026-07-29 1:52 ` [PATCH v4 10/11] HID: steam: Reject short reads Vicki Pfau
2026-07-29 1:52 ` [PATCH v4 11/11] HID: steam: Retry send/recv reports if stale 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=20260729021123.DEC851F000E9@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