linux/drivers/iio/imu
Francesco Lavra 4d60ffcded iio: imu: st_lsm6dsx: fix iio_chan_spec for sensors without event detection
commit c34e2e2d67 upstream.

The st_lsm6dsx_acc_channels array of struct iio_chan_spec has a non-NULL
event_spec field, indicating support for IIO events. However, event
detection is not supported for all sensors, and if userspace tries to
configure accelerometer wakeup events on a sensor device that does not
support them (e.g. LSM6DS0), st_lsm6dsx_write_event() dereferences a NULL
pointer when trying to write to the wakeup register.
Define an additional struct iio_chan_spec array whose members have a NULL
event_spec field, and use this array instead of st_lsm6dsx_acc_channels for
sensors without event detection capability.

Fixes: b5969abfa8 ("iio: imu: st_lsm6dsx: add motion events")
Signed-off-by: Francesco Lavra <flavra@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-30 10:28:41 +01:00
..
bmi160 iio: imu: bmi160_core: make use of iio_for_each_active_channel() 2024-08-03 10:13:40 +01:00
bmi323 IIO: 1st set of fixes for the 6.12 cycle. 2024-10-13 17:23:47 +02:00
bno055 iio: imu: bno055: fix OOB access of hw_xlate array 2025-08-28 16:30:57 +02:00
inv_icm42600 iio: imu: inv_icm42600: Avoid configuring if already pm_runtime suspended 2025-10-23 16:20:40 +02:00
inv_mpu6050 iio: imu: inv_mpu6050: align buffer for timestamp 2025-05-18 08:24:52 +02:00
st_lsm6dsx iio: imu: st_lsm6dsx: fix iio_chan_spec for sensors without event detection 2026-01-30 10:28:41 +01:00
st_lsm9ds0 iio: st_sensors: lsm9ds0: Use common style for terminator in ID tables 2024-02-19 19:32:22 +00:00
adis.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
adis16400.c iio: imu: adis16400: drop ifdef around CONFIG_DEBUG_FS 2024-08-10 11:39:57 +01:00
adis16460.c iio: imu: adis16460: drop ifdef around CONFIG_DEBUG_FS 2024-08-10 11:39:57 +01:00
adis16475.c iio: imu: adis16475: drop ifdef around CONFIG_DEBUG_FS 2024-08-10 11:39:57 +01:00
adis16480.c iio: imu: adis16480: drop ifdef around CONFIG_DEBUG_FS 2024-08-10 11:39:57 +01:00
adis_buffer.c iio: imu: adis: move to the cleanup magic 2024-06-25 21:04:49 +01:00
adis_trigger.c iio: imu: adis_trigger: Allow level interrupts for FIFO readings 2024-06-04 19:53:09 +01:00
fxos8700.h iio: imu: Add support for the FXOS8700 IMU 2019-10-22 10:24:50 +01:00
fxos8700_core.c iio: imu: fxos8700: fix MAGN sensor scale and unit 2023-01-21 18:15:19 +00:00
fxos8700_i2c.c iio: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-05-27 09:48:57 +01:00
fxos8700_spi.c iio: imu: fxos8700: Drop ACPI_PTR() usage 2024-01-23 22:06:55 +00:00
Kconfig drivers: iio: imu: Add support for ADIS16501 2024-06-04 19:53:09 +01:00
kmx61.c iio: imu: kmx61: fix information leak in triggered buffer 2025-01-17 13:40:56 +01:00
Makefile iio: imu: Add driver for BMI323 IMU 2023-11-16 19:10:25 +00:00