linux/drivers/iio
Jonathan Cameron c7975bd7fd iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
commit 10ab7cfd55 upstream.

One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes).  This is not guaranteed in
this driver which uses a 16 byte array of smaller elements on the stack.
This is fixed by using an explicit c structure. As there are no
holes in the structure, there is no possiblity of data leakage
in this case.

The explicit alignment of ts is not strictly necessary but potentially
makes the code slightly less fragile.  It also removes the possibility
of this being cut and paste into another driver where the alignment
isn't already true.

Fixes: 36e0371e77 ("iio:itg3200: Use iio_push_to_buffers_with_timestamp()")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200722155103.979802-6-jic23@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05 11:08:51 +01:00
..
accel iio:accel:mma8452: Fix timestamp alignment and prevent data leak. 2020-09-17 13:45:28 +02:00
adc iio:adc:ti-adc12138 Fix alignment issue with timestamp 2020-11-05 11:08:50 +01:00
afe
amplifiers
buffer
chemical iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-09-17 13:45:28 +02:00
common iio: st_sensors: rely on odr mask to know if odr can be set 2020-04-29 16:31:24 +02:00
counter
dac iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw() 2020-08-21 11:05:31 +02:00
dummy
frequency
gyro iio:gyro:itg3200: Fix timestamp alignment and prevent data leak. 2020-11-05 11:08:51 +01:00
health iio:health:afe4404 Fix timestamp alignment and prevent data leak. 2020-07-22 09:32:05 +02:00
humidity iio:humidity:hts221 Fix alignment and data leak issues 2020-07-22 09:32:02 +02:00
imu iio: imu: adis16400: fix memory leak 2020-08-05 10:05:59 +02:00
light iio:light:si1145: Fix timestamp alignment and prevent data leak. 2020-11-05 11:08:50 +01:00
magnetometer iio:magnetometer:ak8975 Fix alignment and data leak issues. 2020-09-17 13:45:27 +02:00
multiplexer
orientation
potentiometer
potentiostat
pressure iio:pressure:ms5611 Fix buffer element alignment 2020-07-22 09:32:02 +02:00
proximity
resolver
temperature
trigger iio: trigger: stm32-timer: disable master mode when stopping 2020-03-25 08:06:10 +01:00
iio_core_trigger.h
iio_core.h
industrialio-buffer.c iio: buffer: align the size of scan bytes to size of the largest element 2020-01-23 08:21:27 +01:00
industrialio-configfs.c
industrialio-core.c
industrialio-event.c
industrialio-sw-device.c
industrialio-sw-trigger.c
industrialio-trigger.c
industrialio-triggered-event.c
inkern.c
Kconfig
Makefile