Linux Input/HID development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Glushkov" <david.glushkov@sntiq.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v6] HID: steelseries: Add MSI Raider A18 HX A9WJG RGB support
Date: Mon, 01 Jun 2026 12:27:36 +0000	[thread overview]
Message-ID: <20260601122736.954D51F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260601121118.8546-1-david.glushkov@sntiq.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing memory barrier when publishing `sd->battery_registered`, leading to a potential race condition and kernel panic in `raw_event`.
--

commit cc3464e1bd82d31b73852e983e4e3aef990bd1d8
Author: David Glushkov <david.glushkov@sntiq.com>

HID: steelseries: Add MSI Raider A18 HX A9WJG RGB support

This patch adds DMI-gated support for internal SteelSeries USB HID devices
for RGB lighting on the MSI Raider A18 HX A9WJG laptop. It exposes them as
multicolor LED class devices.

Link: https://lore.kernel.org/oe-kbuild-all/202606010709.X0QYNjFZ-lkp@intel.com/

> diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c
> --- a/drivers/hid/hid-steelseries.c
> +++ b/drivers/hid/hid-steelseries.c
> @@ -509,6 +528,7 @@ static int steelseries_headset_battery_register(struct steelseries_device *sd)
>  	power_supply_powers(sd->battery, &sd->hdev->dev);
>  
>  	INIT_DELAYED_WORK(&sd->battery_work, steelseries_headset_battery_timer_tick);
> +	sd->battery_registered = true;

[Severity: High]
Since hid_hw_start() is called earlier in the steelseries_probe() sequence,
could the store to sd->battery_registered be reordered before the
initialization of sd->battery_work by the compiler or on weakly-ordered CPUs?

If this reordering occurs, the interrupt-driven steelseries_headset_raw_event
handler might locklessly observe battery_registered as true prematurely. This
would lead to schedule_delayed_work() being called on a partially initialized
work_struct, which could cause a kernel panic in the timer core.

Would it be safer to publish this flag using smp_store_release() to ensure
the delayed work initialization is fully visible before the flag is set?

>  	steelseries_headset_fetch_battery(sd->hdev);
>  
>  	if (sd->quirks & STEELSERIES_ARCTIS_9) {

[ ... ]

> @@ -855,6 +885,9 @@ static int steelseries_headset_raw_event(struct hid_device *hdev,
>  	if (!steelseries_is_headset(hdev))
>  		return 0;
>  
> +	sd = hid_get_drvdata(hdev);
> +	if (!sd || !sd->battery_registered)
> +		return 0;
> +
>  	capacity = sd->battery_capacity;

[Severity: High]
To safely pair with the suggested smp_store_release() in the initialization
path, should this lockless read of sd->battery_registered be done using
smp_load_acquire()?

This check happens directly in the raw_event handler, so it needs memory
barriers to guarantee that if it reads true, the fully initialized work_struct
is visible to this CPU before we subsequently call schedule_delayed_work() on
it later in this function.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260601121118.8546-1-david.glushkov@sntiq.com?part=1

  reply	other threads:[~2026-06-01 12:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-31 21:52 [PATCH] HID: steelseries: Add MSI Raider A18 HX A9WJG RGB support David Glushkov
2026-05-31 22:06 ` sashiko-bot
2026-05-31 22:21 ` [PATCH v2] " David Glushkov
2026-05-31 22:34   ` sashiko-bot
2026-05-31 22:53 ` [PATCH v3] " David Glushkov
2026-05-31 23:12   ` sashiko-bot
2026-05-31 23:22 ` [PATCH v4] " David Glushkov
2026-05-31 23:39 ` [PATCH v5] " David Glushkov
2026-06-01  9:04   ` kernel test robot
2026-06-01 12:11 ` [PATCH v6] " David Glushkov
2026-06-01 12:27   ` sashiko-bot [this message]
2026-06-01 12:37 ` [PATCH v7] " David Glushkov

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=20260601122736.954D51F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=david.glushkov@sntiq.com \
    --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