Re: [PATCH] iio: hid-sensors: Fix poll_value sign check before msleep_interruptible

From: Joshua Crofts

Date: Wed Jul 01 2026 - 12:22:20 EST


On Wed, 1 Jul 2026 22:43:19 +0700
Kittisak Boonmapa <goorock.goopop@xxxxxxxxx> wrote:

> hid_sensor_read_poll_value() returns -EINVAL when the HID descriptor
> does not contain a Report Interval feature field.
>
> _hid_sensor_power_state() currently treats any non-zero value as a
> valid delay and passes it to msleep_interruptible(). Since
> msleep_interruptible() takes an unsigned int, negative values are
> converted into very large delays.
>
> Only sleep when poll_value is positive.
>
> Fixes: 5d9854eaea77 ("iio: hid-sensor: Store restore poll and hysteresis on S3")
> Closes: https://lore.kernel.org/linux-iio/CAPr6G1qLDrgHvCNsVxj7xHxYUKkAkyo87Hq3Lfyoj3RaZ2v4dg@xxxxxxxxxxxxxx/
> Reported-by: Kittisak Boonmapa <goorock.goopop@xxxxxxxxx>
> Assisted-by: Anthropic:Claude Sonnet 4.6
> Signed-off-by: Kittisak Boonmapa <goorock.goopop@xxxxxxxxx>
>
> ---

This bug was introduced 9 years ago!

Reviewed-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>

--
Kind regards

CJD