linux-stable/drivers/iio
Jonathan Cameron a18aeac73c iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046
commit 9020ef6598 upstream.

IIO triggers are software IRQ chips that split an incoming IRQ into
separate IRQs routed to all devices using the trigger.
When all consumers are done then a trigger callback reenable() is
called.  There are a few circumstances under which this can happen
in atomic context.

1) A single user of the trigger that calls the iio_trigger_done()
function from interrupt context.
2) A race between disconnecting the last device from a trigger and
the trigger itself sucessfully being disabled.

To avoid a resulting scheduling whilst atomic, close this second corner
by using schedule_work() to ensure the reenable is not done in atomic
context.

Note that drivers must be careful to manage the interaction of
set_state() and reenable() callbacks to ensure appropriate reference
counting if they are relying on the same hardware controls.

Deliberately taking this the slow path rather than via a fixes tree
because the error has hard to hit and I would like it to soak for a while
before hitting a release kernel.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211017172209.112387-1-jic23@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 11:02:57 +01:00
..
accel iio: accel: kxcjk-1013: Fix possible memory leak in probe and remove 2021-12-14 10:57:21 +01:00
adc iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs 2022-01-27 11:02:57 +01:00
afe iio: afe: iio-rescale: Support processed channels 2021-06-03 18:24:13 +01:00
amplifiers
buffer iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
cdc iio:cdc:ad7150: Fix use of uninitialized ret 2021-04-07 08:36:39 +01:00
chemical iio: chemical: Add driver support for sgp40 2021-08-08 15:19:18 +01:00
common iio: ssp_sensors: add more range checking in ssp_parse_dataframe() 2021-09-18 19:10:55 +01:00
dac iio: ad5770r: make devicetree property reading consistent 2021-11-18 19:16:07 +01:00
dummy iio: dummy: Fix build error when CONFIG_IIO_TRIGGERED_BUFFER is not set 2021-06-13 17:00:17 +01:00
frequency iio: frequency: adf4350: disable reg and clk on error in adf4350_probe() 2021-06-13 17:00:17 +01:00
gyro iio: itg3200: Call iio_trigger_notify_done() on error 2021-12-14 10:57:21 +01:00
health iio: core: move @id from struct iio_dev to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
humidity iio: humidity: hdc100x: Add margin to the conversion time 2021-07-24 18:13:02 +01:00
imu iio: imu: st_lsm6dsx: Avoid potential array overflow in st_lsm6dsx_set_odr() 2021-11-25 09:48:29 +01:00
light iio: ltr501: Don't return error code in trigger handler 2021-12-14 10:57:21 +01:00
magnetometer iio: st_sensors: disable regulators after device unregistration 2021-11-18 19:16:46 +01:00
multiplexer
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: Add driver support for AD5110 2021-08-15 15:38:16 +01:00
potentiostat iio: potentiostat: lmp91000: Fix alignment of buffer in iio_push_to_buffers_with_timestamp() 2021-05-17 13:54:30 +01:00
pressure iio: st_pressure_spi: Add missing entries SPI to device ID table 2021-11-18 19:16:50 +01:00
proximity iio: sx9310: Support ACPI property 2021-07-31 15:15:28 +01:00
resolver
temperature iio: ltc2983: fix device probe 2021-08-15 16:58:37 +01:00
test iio/test-format: build kunit tests without structleak plugin 2021-10-06 17:53:36 -06:00
trigger iio: trigger: stm32-timer: fix MODULE_ALIAS 2021-12-14 10:57:20 +01:00
iio_core.h
iio_core_trigger.h
industrialio-buffer.c iio: buffer: Fix double-free in iio_buffers_alloc_sysfs_and_mask() 2021-11-18 19:16:53 +01:00
industrialio-configfs.c
industrialio-core.c iio: core: check return value when calling dev_set_name() 2021-11-18 19:16:02 +01:00
industrialio-event.c iio:event: Add timeout event info type 2021-04-07 08:36:36 +01:00
industrialio-sw-device.c
industrialio-sw-trigger.c
industrialio-trigger.c iio: trigger: Fix a scheduling whilst atomic issue seen on tsc2046 2022-01-27 11:02:57 +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: core: move @info_exist_lock to struct iio_dev_opaque 2021-05-17 13:49:13 +01:00
Kconfig iio:cdc:ad7150: Move driver out of staging. 2021-04-07 08:36:37 +01:00
Makefile iio:cdc:ad7150: Move driver out of staging. 2021-04-07 08:36:37 +01:00
TODO