linux/drivers/iio
Luca Ceresoli 748ebd8e61 iio: light: opt3001: fix deadlock due to concurrent flag access
[ Upstream commit f063a28002 ]

The threaded IRQ function in this driver is reading the flag twice: once to
lock a mutex and once to unlock it. Even though the code setting the flag
is designed to prevent it, there are subtle cases where the flag could be
true at the mutex_lock stage and false at the mutex_unlock stage. This
results in the mutex not being unlocked, resulting in a deadlock.

Fix it by making the opt3001_irq() code generally more robust, reading the
flag into a variable and using the variable value at both stages.

Fixes: 94a9b7b180 ("iio: light: add support for TI's opt3001 light sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://patch.msgid.link/20250321-opt3001-irq-fix-v1-1-6c520d851562@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
[ Adjust context ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-09-09 18:54:19 +02:00
..
accel iio: accel: fxls8962af: Fix use after free in fxls8962af_fifo_flush 2025-07-24 08:51:50 +02:00
adc iio: adc: ad_sigma_delta: change to buffer predisable 2025-08-28 16:26:06 +02:00
addac iio: addac: Kconfig: update ad74413r selections 2023-10-19 23:08:55 +02:00
afe iio: afe: rescale: Accept only offset channels 2023-11-02 09:35:29 +01:00
amplifiers iio: amplifiers: ada4250: add missing select REGMAP_SPI in Kconfig 2024-10-22 15:56:47 +02:00
buffer iio: buffer-dmaengine: fix releasing dma channel on error 2024-09-12 11:10:26 +02:00
cdc iio: cdc: ad7746: Move driver out of staging. 2022-08-15 22:30:01 +01:00
chemical iio: chemical: pms7003: use aligned_s64 for timestamp 2025-09-09 18:54:19 +02:00
common iio: hid-sensors: Fix an error handling path in _hid_sensor_set_report_latency() 2024-10-22 15:56:47 +02:00
dac iio: dac: ad3552r: clear reset status flag 2025-03-13 12:53:23 +01:00
dummy iio: dummy: iio_simply_dummy_buffer: fix information leak in triggered buffer 2025-01-17 13:34:45 +01:00
filter iio: filter: admv8818: Support frequencies >= 2^32 2025-06-27 11:07:16 +01:00
frequency iio: frequency: admv4420: fix missing select REMAP_SPI in Kconfig 2024-11-01 01:55:58 +01:00
gyro iio: gyro: fxas21002c: Fix missing data update in trigger handler 2025-01-17 13:34:46 +01:00
health iio: health: afe4404: Fix oob read in afe4404_[read|write]_raw 2022-11-12 16:30:23 +00:00
humidity i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
imu iio: imu: inv_icm42600: change invalid data error to -EBUSY 2025-08-28 16:26:16 +02:00
light iio: light: opt3001: fix deadlock due to concurrent flag access 2025-09-09 18:54:19 +02:00
magnetometer iio: magnetometer: yas530: use signed integer type for clamp limits 2024-12-14 19:54:31 +01:00
multiplexer iio: multiplexer: Make use of device properties 2022-04-04 09:11:24 +01:00
orientation iio: hid-sensors: bind IIO channels alloc to device object 2021-07-13 18:21:53 +01:00
position iio: hid-sensors: Update header includes 2021-06-16 14:53:13 +01:00
potentiometer iio: potentiometer: mcp4131: Fix alignment for DMA safety 2022-06-14 11:53:19 +01:00
potentiostat i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
pressure iio: pressure: bmp280: Use IS_ERR() in bmp280_common_probe() 2025-08-28 16:26:14 +02:00
proximity iio: proximity: isl29501: fix buffered read on big-endian systems 2025-08-28 16:26:14 +02:00
resolver iio: resolver: ad2s90: Fix alignment for DMA safety 2022-06-14 11:53:19 +01:00
temperature iio: temperature: maxim_thermocouple: use DMA-safe buffer for spi_read() 2025-08-28 16:26:16 +02:00
test iio: test: Mark file local structure arrays static. 2022-08-15 22:30:01 +01:00
trigger iio: trigger: sysfs: fix possible memory leak in iio_sysfs_trig_init() 2022-10-24 18:48:57 +01:00
iio_core.h iio: Mark iio_device_type as const 2021-11-17 17:51:35 +00:00
iio_core_trigger.h iio: core-trigger: make iio_device_register_trigger_consumer() an int return 2021-03-11 20:47:02 +00:00
industrialio-buffer.c iio: buffer: make sure O_NONBLOCK is respected 2023-04-13 16:55:27 +02:00
industrialio-configfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-core.c driver: iio: add missing checks on iio_info's callback access 2024-09-08 07:53:11 +02:00
industrialio-event.c driver: iio: add missing checks on iio_info's callback access 2024-09-08 07:53:11 +02:00
industrialio-sw-device.c iio: Don't use bare "unsigned" 2022-07-01 11:19:08 +01:00
industrialio-sw-trigger.c iio: core: Fix entry not deleted when iio_register_sw_trigger_type() fails 2022-11-12 17:53:35 +00:00
industrialio-trigger.c iio: Add blank lines after declarations. 2022-08-15 22:29:56 +01:00
industrialio-triggered-event.c iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
inkern.c iio: inkern: call iio_device_put() only on mapped devices 2025-01-17 13:34:46 +01:00
Kconfig iio: add filter subfolder 2021-12-16 17:29:46 +00:00
Makefile iio: add filter subfolder 2021-12-16 17:29:46 +00:00
TODO iio: add a TODO 2020-03-08 17:28:53 +00:00