Re: [PATCH v1] HID: sensor-hub: Fail unfinished multi-value reads on removal
From: Andy Shevchenko
Date: Fri Sep 11 2026 - 05:51:11 EST
On Fri, Sep 11, 2026 at 05:20:39PM +0800, Yibo Tan wrote:
> sensor_hub_remove() completes pending reads after stopping the HID device,
> but does not record why they completed. A successful completion wait
> therefore returns zero even if no complete input report was received.
> Multi-value IIO callers then format their untouched automatic buffer as a
> successful result.
>
> With a valid four-element signed 32-bit quaternion report descriptor, an
> unprivileged reader received all 16 bytes of the untouched buffer. Across
> 11 independent KASLR-enabled boots, four reads exposed exact pointers to
> dev_rot_channels or dev_sysfs_ops. Subtracting the matching link-time
> symbol address recovered the kernel KASLR slide in all four cases.
>
> The reader ran as UID/GID 65534 with no effective capabilities through the
> mode-0644 IIO attribute. The test used a privileged UHID broker to create
> and remove the provider; it does not demonstrate unprivileged provider
> removal.
>
> Publish -ENODEV through pending.raw_size before completing an unfinished
> multi-value request, and propagate the error after a successful wait. A
> fully received response already has a positive raw_size and remains
> successful; max_raw_size is zero for the separate single-value path.
>
> The Root B-only repair returned -ENODEV with no payload or kernel
> diagnostic in 3/3 matching signed-32-bit runs.
>
> A source reproducer, complete vulnerable and fixed serial logs, result
> tables, and checksums are available at:
> https://github.com/kimaiden1984-boop/linux-kernel-poc-collections/tree/main/cases/hid-sensor-quaternion-root-b-kaslr
Make it a Link tag and add reference to the text.
> Fixes: f784fcea4506 ("HID: sensor-hub: Add sensor_hub_input_attr_read_values() for multi-byte reads")
> Cc: stable@xxxxxxxxxxxxxxx
> Assisted-by: Codex:GPT-5
Assisted-by: LLM
--
With Best Regards,
Andy Shevchenko