linux/drivers/iio/imu
Francesco Lavra 81ed6e42d6 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:32:16 +01:00
..
bmi160 iio: imu: bmi160: make bmi160_regs const 2025-07-06 10:37:53 +01:00
bmi270 iio: imu: bmi270: fix dev_err_probe error msg 2025-12-18 14:02:54 +01:00
bmi323 iio: imu: bmi323: Remove dev_err_probe() if error is -ENOMEM 2025-08-25 09:40:32 +01:00
bno055 Driver core changes for 6.17-rc1 2025-07-29 12:15:39 -07:00
inv_icm42600 Linux 6.17-rc3 2025-09-13 15:00:48 +01:00
inv_mpu6050 iio: imu: Remove redundant pm_runtime_mark_last_busy() calls 2025-08-25 16:06:04 +01:00
st_lsm6dsx iio: imu: st_lsm6dsx: fix iio_chan_spec for sensors without event detection 2026-01-30 10:32:16 +01:00
st_lsm9ds0 iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
adis.c iio: imu: adis: remove bits_per_word = 8 2025-05-21 14:20:31 +01:00
adis16400.c iio: imu: adis16400: Use separate structures rather than an array for chip info 2025-07-13 15:36:24 +01:00
adis16460.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
adis16475.c iio: imu: adis16475: remove extra line 2025-08-16 11:57:07 +01:00
adis16480.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
adis16550.c iio: imu: adis16550: align buffers for timestamp 2025-04-21 11:51:35 +01:00
adis_buffer.c iio: imu: adis: remove bits_per_word = 8 2025-05-21 14:20:31 +01:00
adis_trigger.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08: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: Drop unused acpi.h 2024-09-30 09:20:59 +01: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 iio: imu: adis16550: add adis16550 support 2025-03-04 13:17:24 +00:00
kmx61.c iio: imu: Remove redundant pm_runtime_mark_last_busy() calls 2025-08-25 16:06:04 +01:00
Makefile iio: imu: adis16550: add adis16550 support 2025-03-04 13:17:24 +00:00
smi240.c iio: imu: smi240: Switch to sparse friendly iio_device_claim/release_direct() 2025-04-22 19:09:59 +01:00