From: sashiko-bot@kernel.org
To: "Derek J. Clark" <derekjohn.clark@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v10 4/4] HID: hid-msi: Add Rumble Intensity Attributes
Date: Thu, 28 May 2026 00:43:39 +0000 [thread overview]
Message-ID: <20260528004340.2C3D91F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260527222122.10620-5-derekjohn.clark@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Medium] Missing functional implementation for rumble intensity feature.
Pre-existing issues:
- [High] Race condition during device teardown leading to Use-After-Free of drvdata.
--
commit 902919289c1cf51c111590532df6640b717c3236
Author: Derek J. Clark <derekjohn.clark@gmail.com>
HID: hid-msi: Add Rumble Intensity Attributes
Adds intensity adjustment for the left and right rumble motors. The patch
introduces the data structures and driver variables for this feature.
> Claude was used during the reverse-engineering data gathering for this
> feature done by Zhouwang Huang. As the code had already been affected,
> I used Claude to create the initial framing for the feature, then did
> manual cleanup of the _show and _store functions afterwards to fix bugs
> and keep the coding style consistent. Claude was also used as an initial
> reviewer of this patch.
[Severity: Medium]
Are the _show and _store functions missing from this patch?
The commit message mentions manual cleanup of these functions, but the diff
only introduces the data structures (like struct claw_rumble_report and
rumble_addr) without any sysfs attributes or functional implementation.
> diff --git a/drivers/hid/hid-msi.c b/drivers/hid/hid-msi.c
> index 96710d80543d4..17b0707ecd46d 100644
> --- a/drivers/hid/hid-msi.c
> +++ b/drivers/hid/hid-msi.c
[ ... ]
> @@ -332,8 +343,12 @@ struct claw_drvdata {
> enum claw_gamepad_mode_index gamepad_mode;
> u8 m1_codes[CLAW_KEYS_MAX];
> u8 m2_codes[CLAW_KEYS_MAX];
> - spinlock_t mode_lock; /* Lock for mode data read/write */
> + u8 rumble_intensity_right;
> + u8 rumble_intensity_left;
> const u16 *bmap_addr;
> + spinlock_t rumble_lock; /* lock for rumble_intensity read/write */
> + spinlock_t mode_lock; /* Lock for mode data read/write */
[Severity: High]
This is a pre-existing issue, but can the device teardown in claw_remove()
cause a use-after-free of this drvdata structure?
In claw_remove(), cancel_delayed_work_sync(&drvdata->rgb_queue) is called
before led_classdev_multicolor_unregister(&drvdata->led_mc).
If a concurrent sysfs write triggers claw_led_brightness_set(), it checks
rgb_registered under a lock but calls mod_delayed_work() after unlocking.
If preempted between these steps, claw_remove() could set the flag to false,
cancel the workqueue, and then block in led_classdev_multicolor_unregister()
waiting for the sysfs operation to finish:
CPU1 CPU2
claw_led_brightness_set()
scoped_guard(...) {
if (!smp_load_acquire(...))
return;
}
// preempted
claw_remove()
smp_store_release(..., false);
cancel_delayed_work_sync(...);
led_classdev_multicolor_unregister(...);
// blocks waiting for CPU1
mod_delayed_work(...);
// finishes, CPU2 unblocks
hid_hw_close(hdev);
// drvdata is freed
When the sysfs thread resumes, it schedules the delayed work on the freed
drvdata.
Should the LED subsystem be unregistered before cancelling the associated
workqueues to flush active sysfs writes?
> + bool rumble_support;
> bool gp_registered;
> bool bmap_support;
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260527222122.10620-1-derekjohn.clark@gmail.com?part=4
next prev parent reply other threads:[~2026-05-28 0:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 22:21 [PATCH v10 0/4] Add MSI Claw HID Configuration Driver Derek J. Clark
2026-05-27 22:21 ` [PATCH v10 1/4] HID: hid-msi: Add MSI Claw configuration driver Derek J. Clark
2026-05-27 22:56 ` sashiko-bot
2026-05-27 22:21 ` [PATCH v10 2/4] HID: hid-msi: Add M-key mapping attributes Derek J. Clark
2026-05-27 23:34 ` sashiko-bot
2026-05-27 22:21 ` [PATCH v10 3/4] HID: hid-msi: Add RGB control interface Derek J. Clark
2026-05-28 0:03 ` sashiko-bot
2026-05-27 22:21 ` [PATCH v10 4/4] HID: hid-msi: Add Rumble Intensity Attributes Derek J. Clark
2026-05-28 0:43 ` sashiko-bot [this message]
2026-05-28 0:49 ` Derek J. Clark
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=20260528004340.2C3D91F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=derekjohn.clark@gmail.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