From: sashiko-bot@kernel.org
To: "Sanjay Chitroda" <sanjayembeddedse@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 1/3] iio: hid-sensor-temperature: use u32 instead of unsigned int
Date: Tue, 16 Jun 2026 13:39:45 +0000 [thread overview]
Message-ID: <20260616133945.DB4F31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616-16-jun-hid-iio-u32-api-type-v1-1-952c74195f46@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Tear-down Order Inversion / Use-After-Free
--
commit fd38c3c8f2adbbb955807f745b5f193e1fd40a85
Author: Sanjay Chitroda <sanjayembeddedse@gmail.com>
iio: hid-sensor-temperature: use u32 instead of unsigned int
This commit updates the type of the usage_id variable from unsigned int
to u32 in the callback API. This improves code clarity and matches the
expected callback API type.
> diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
> index 9f628a8e5cfbe..a8d3a15f9c531 100644
> --- a/drivers/iio/temperature/hid-sensor-temperature.c
> +++ b/drivers/iio/temperature/hid-sensor-temperature.c
[ ... ]
> @@ -159,7 +159,7 @@ static int temperature_capture_sample(struct hid_sensor_hub_device *hsdev,
> static int temperature_parse_report(struct platform_device *pdev,
> struct hid_sensor_hub_device *hsdev,
> struct iio_chan_spec *channels,
> - unsigned int usage_id,
> + u32 usage_id,
> struct temperature_state *st)
> {
> int ret;
[Severity: High]
This is a pre-existing issue, but does hid_temperature_remove() tear down
the trigger and callback too early?
Because the driver uses devm_iio_device_register(), the IIO device will not
be unregistered until after the driver's remove function returns.
However, hid_temperature_remove() manually unregisters the trigger and
callbacks before that:
drivers/iio/temperature/hid-sensor-temperature.c:hid_temperature_remove() {
...
sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE);
hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes);
}
Could this leave a race condition window where the IIO device and its
sysfs/char interfaces are still fully accessible to userspace, but its
backing trigger and callbacks have already been destroyed?
Can concurrent access from userspace during this window lead to a
use-after-free?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260616-16-jun-hid-iio-u32-api-type-v1-0-952c74195f46@gmail.com?part=1
next prev parent reply other threads:[~2026-06-16 13:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 13:25 [PATCH 0/3] HID: iio: callback API signature match for usage_id Sanjay Chitroda
2026-06-16 13:25 ` [PATCH 1/3] iio: hid-sensor-temperature: use u32 instead of unsigned int Sanjay Chitroda
2026-06-16 13:39 ` sashiko-bot [this message]
2026-06-16 13:25 ` [PATCH 2/3] iio: hid-sensor-humidity: " Sanjay Chitroda
2026-06-16 13:50 ` sashiko-bot
2026-06-16 13:25 ` [PATCH 3/3] iio: hid-sensor-custom-intel-hinge: " Sanjay Chitroda
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=20260616133945.DB4F31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sanjayembeddedse@gmail.com \
--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