]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: light: si1133: prevent race condition on timeout
authorJoshua Crofts <joshua.crofts1@gmail.com>
Tue, 5 May 2026 07:31:27 +0000 (09:31 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:34 +0000 (10:59 +0100)
commit8c50a95ceb230d17801758a9e41ffbbbe46f8b4d
tree93ba094c779e60b8dc83a39689bc904e56852ff7
parent0a5f45ed2342aabae1e32c72558d15be28940a95
iio: light: si1133: prevent race condition on timeout

Sashiko reported a bug where the si1133_command exits on timeout
without halting the sensor or masking the interrupt. If the sensor
completes the command later, any subsequent command to the sensor
will cause the IRQ handler to complete immediately, returning stale
data to the driver all while the command hasn't finished yet, shifting
all potential reads in the future.

Fix this by masking the IRQ if wait_for_completion_timeout() fails.
When initiating a new command, do a dummy read of the IRQ_STATUS
register and turn the IRQ back on.

Fixes: e01e7eaf37d8 ("iio: light: introduce si1133")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/message/20260428-si1133-checkup-v2-5-70ad14bfefe2%40gmail.com
Assisted-by: gemini:gemini-3.1-pro-preview
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/light/si1133.c