From: sashiko-bot@kernel.org
To: DevExalt <exalt.dev.team@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v3] HID: logitech-hidpp: Add support for HID++ Multi-Platform feature (0x4531)
Date: Tue, 30 Jun 2026 10:13:30 +0000 [thread overview]
Message-ID: <20260630101330.697631F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630094838.50471-1-exalt.dev.team@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Use-after-destroy of `hidpp->send_mutex` and operations on stopped hardware due to delayed sysfs group removal.
--
commit 55433f57873d505e62b905c239d0015edd306ae5
Author: Baraa Atta (Dev Exalt) <exalt.dev.team@gmail.com>
HID: logitech-hidpp: Add support for HID++ Multi-Platform feature (0x4531)
Add support in the Logitech HID++ driver for the HID++ Multi-Platform
feature (0x4531), which enables HID++ devices to adjust their behavior
based on the host operating system.
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 90b0184df777f..33904f3093803 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
[ ... ]
> @@ -4780,6 +4780,26 @@ static void hidpp_multiplatform_init(struct hidpp_device *hidpp)
> {
> struct hid_device *hdev = hidpp->hid_dev;
> u8 feat_index;
> int ret;
>
> ret = hidpp_root_get_feature(hidpp, HIDPP_MULTIPLATFORM_FEAT_ID, &feat_index);
> if (ret)
> return;
>
> hidpp->multiplatform_feature_index = feat_index;
>
> ret = devm_mutex_init(&hdev->dev, &hidpp->multiplatform_lock);
> if (ret) {
> hid_warn(hdev,
> "Multiplatform: Failed to init mutex (err=%d)\n", ret);
> hidpp->multiplatform_feature_index = 0;
> return;
> }
>
> ret = devm_device_add_group(&hdev->dev, &multiplatform_attribute_group);
[Severity: High]
Does this create a use-after-destroy race condition during device unbind?
Because devm_device_add_group() is used, the sysfs group is scheduled for
removal during the devres phase, which runs after the driver's remove callback
returns.
In hidpp_remove(), the hardware state is explicitly torn down and the mutex is
destroyed:
drivers/hid/hid-logitech-hidpp.c:hidpp_remove() {
...
hid_hw_stop(hdev);
cancel_work_sync(&hidpp->work);
cancel_work_sync(&hidpp->reset_hi_res_work);
mutex_destroy(&hidpp->send_mutex);
}
The sysfs attribute remains accessible to userspace during and shortly after
hidpp_remove() runs. A concurrent write to the platform sysfs attribute could
trigger platform_store(), which eventually attempts to lock the destroyed
hidpp->send_mutex and perform I/O on stopped hardware.
> if (ret) {
> hid_warn(hdev,
> "Multiplatform: Failed to create sysfs group (err=%d)\n", ret);
> hidpp->multiplatform_feature_index = 0;
> }
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630094838.50471-1-exalt.dev.team@gmail.com?part=1
next prev parent reply other threads:[~2026-06-30 10:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 8:08 [PATCH v2] HID: logitech-hidpp: Add support for HID++ Multi-Platform feature (0x4531) DevExalt
2026-06-25 8:18 ` sashiko-bot
2026-06-30 9:48 ` [PATCH v3] " DevExalt
2026-06-30 10:13 ` sashiko-bot [this message]
2026-07-01 6:30 ` [PATCH v4] " DevExalt
2026-07-01 6:43 ` sashiko-bot
2026-07-01 7:37 ` [PATCH v5] " DevExalt
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=20260630101330.697631F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=exalt.dev.team@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