From: Shan Rizvi <shan@rizvi.nu>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Jonathan Cameron <jic23@kernel.org>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>
Cc: linux-iio@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: iio: hid-sensor-trigger: unclamped msleep_interruptible(poll_value * 2) stalls runtime PM for hours on Chicony 04F2:B872 secondary proximity sensor
Date: Sun, 29 Nov 2026 14:18:28 -0500 [thread overview]
Message-ID: <179597990855.41.2142056846322501706@rizvi.nu> (raw)
In-Reply-To: <b9ac1fb0e7bf68c915b03f0fca4a56a4412e2191.camel@linux.intel.com>
On Sun, 2026-11-29 at 09:54 -0800, Srinivas Pandruvada wrote:
> This may be better. Try the attached:
That works very cleanly on the HP 8EA2 laptop!
With invalid_sensor.diff applied to hid-sensor-iio-common:
- HID-SENSOR-200011.6.auto (0.000100 Hz) is cleanly rejected at probe
time before any iio:device is registered:
hid-sensor-hub 0003:04F2:B872.0001: Invalid sampling interval, will cause task hangs
hid_sensor_prox HID-SENSOR-200011.6.auto: failed to setup common attributes
hid_sensor_prox HID-SENSOR-200011.6.auto: probe with driver hid_sensor_prox failed with error -22
- The four real sensors (HID-SENSOR-200011.3.auto 10 Hz prox,
HID-SENSOR-200041.4.auto ALS, HID-SENSOR-200073.9.auto accel_3d,
HID-SENSOR-200076.10.auto gyro_3d) all probe and read normally, with
no runtime PM underflows and clean module unload/reload.
Tested-by: Shan Rizvi <shan@rizvi.nu>
Three minor review notes for the formal patch:
1. value is s32 (hid-sensor-attributes.c:516), so casting
(u64)value * 2 >= max_sleep_ms avoids signed 32-bit overflow for
descriptors with large 32-bit Report Intervals (REPORT_ID 17 here
declares max=2147483647).
2. Applying the same upper-bound check in
hid_sensor_write_samp_freq_value() (and checking poll_value > 0 in
hid-sensor-trigger.c:_hid_sensor_power_state()) would also prevent
userspace from configuring a hang-inducing sampling frequency after
probe or passing a negative error to msleep_interruptible().
3. Minor whitespace nit: "value =\thid_sensor_read_poll_value(st);" has
a tab after '='.
Thanks again for the fast turnaround!
Shan Rizvi
prev parent reply other threads:[~2026-11-29 19:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 2:03 iio: hid-sensor-trigger: unclamped msleep_interruptible(poll_value * 2) stalls runtime PM for hours on Chicony 04F2:B872 secondary proximity sensor Shan Rizvi
2026-11-29 14:37 ` Srinivas Pandruvada
2026-11-29 17:26 ` Shan Rizvi
2026-11-29 17:54 ` Srinivas Pandruvada
2026-11-29 19:18 ` Shan Rizvi [this message]
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=179597990855.41.2142056846322501706@rizvi.nu \
--to=shan@rizvi.nu \
--cc=bentiss@kernel.org \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=srinivas.pandruvada@linux.intel.com \
/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