linux/drivers/iio/gyro
David Carlier 6bdc3023d6 iio: gyro: itg3200: fix i2c read into the wrong stack location
itg3200_read_all_channels() takes `__be16 *buf' as a parameter and
fills the i2c_msg destination as `(char *)&buf'. Since `buf' is the
parameter (a pointer), `&buf' is the address of the local pointer
slot on the stack of itg3200_read_all_channels(), not the address
of the caller's scan buffer. The (char *) cast hides the type
mismatch.

i2c_transfer() therefore writes ITG3200_SCAN_ELEMENTS * sizeof(s16)
= 8 bytes into the parameter's stack slot, which is discarded when
the function returns. The caller's scan buffer in
itg3200_trigger_handler() is never written to, so
iio_push_to_buffers_with_timestamp() pushes uninitialised stack
contents to userspace via /dev/iio:deviceX every scan -- both a
functional bug (no actual gyroscope or temperature data is
delivered through the triggered buffer) and an information leak.

The non-buffered read_raw() path is unaffected: it goes through
itg3200_read_reg_s16() which uses `&out' on a local s16 value,
where that is correct.

Drop the spurious `&' so the i2c read writes into the caller's
buffer.

Fixes: 9dbf091da0 ("iio: gyro: Add itg3200")
Cc: stable@vger.kernel.org
Signed-off-by: David Carlier <devnexen@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
History 2026-05-15 12:05:35 +01:00
..
adis16080.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
adis16130.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
adis16136.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
adis16260.c iio: gyro: adis16260: fix division by zero in write_raw 2026-04-28 16:36:09 +01:00
adxrs290.c iio: Replace IRQF_ONESHOT with IRQF_NO_THREAD 2026-01-29 16:11:50 +00:00
adxrs450.c iio: gyro: adxrs450: remove bits_per_word = 8 2025-05-21 14:20:31 +01:00
bmg160.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bmg160_core.c iio: gyro: Remove redundant pm_runtime_mark_last_busy() calls 2025-08-25 16:04:47 +01:00
bmg160_i2c.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
bmg160_spi.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
fxas21002c.h iio: gyro: fxas21002c: Move 'fxas21002c_reg_fields' to the only file its used 2020-07-20 09:03:25 +01:00
fxas21002c_core.c iio: gyro: Remove redundant pm_runtime_mark_last_busy() calls 2025-08-25 16:04:47 +01:00
fxas21002c_i2c.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
fxas21002c_spi.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
hid-sensor-gyro-3d.c iio: hid-sensor-gyro-3d: fix typo in array name 2026-03-01 12:10:29 +00:00
itg3200_buffer.c iio: gyro: itg3200: fix i2c read into the wrong stack location 2026-05-15 12:05:35 +01:00
itg3200_core.c iio: gyro: itg3200: Fix unchecked return value in read_raw 2026-01-29 17:07:07 +00:00
Kconfig iio: gyro: list adis16137 in Kconfig description 2024-10-21 19:19:24 +01:00
Makefile iio: gyro: Add driver support for ADXRS290 2020-08-22 10:53:20 +01:00
mpu3050-core.c iio: gyro: mpu3050: Fix out-of-sequence free_irq() 2026-03-01 11:20:11 +00:00
mpu3050-i2c.c iio: gyro: mpu3050-i2c: fix pm_runtime error handling 2026-02-23 08:24:38 +00:00
mpu3050.h iio: gyro: mpu3050: Make mpu3050_common_remove() return void 2022-05-01 19:01:13 +01:00
ssp_gyro_sensor.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
st_gyro.h iio: gyro: st_gyro: use devm_iio_triggered_buffer_setup() for buffer 2021-07-24 16:35:05 +01:00
st_gyro_buffer.c iio:st-sensors: Remove duplicate MODULE_* 2022-02-18 11:36:54 +00:00
st_gyro_core.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
st_gyro_i2c.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00
st_gyro_spi.c iio: normalize array sentinel style 2025-04-22 19:10:04 +01:00