Re: [PATCH v2 0/8] HID: iio: Avoid race between callback setup and device exposure
From: Andy Shevchenko <hidden>
Date: 2026-06-23 10:30:33
Also in:
linux-iio, lkml
On Mon, Jun 22, 2026 at 10:59:56AM +0530, Sanjay Chitroda wrote:
This series avoid a race condition in HID IIO drivers related to the ordering between callback registration and device exposure. Currently, several HID IIO drivers register the IIO device (making it visible to userspace and other kernel consumers) before all required callbacks and resources are fully initialized, or rely on devm-based cleanup in a way that does not guarantee correct teardown ordering. This creates a window where the device can be accessed while it is
There is a difference between "this creates" and "this might create". I believe Srinivas and others were asking for the proof. So, what path in the code makes this happen or possible to happen?
not fully initialized or is being torn down, potentially leading to
sample drop or stale/no data.
To handle this, the series ensures that:
- All required callbacks and resources are set up before the device
is registered with the IIO core
- Resource cleanup is performed explicitly where ordering matters
PS: This is prepratory series to convert all HID IIO driver to devm.
Testing:
- Compiled with W=1 for each patch in series
---
Changes in v2:
- Drop fixes tag and rectify commit message with reference to thatYou also dropped my tag. Why?
- Link to v1: https://patch.msgid.link/20260606-5-june-hid-iio-race-fixes-v1-0-27a848c5758f@gmail.com
-- With Best Regards, Andy Shevchenko