1
0
Fork 0
alistair23-linux/drivers/iio/gyro
Jonathan Cameron 829c0a9634 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:43:30 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile iio: gyro: fxas21002c: add spi driver 2019-04-22 11:34:12 +01:00
adis16080.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adis16130.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adis16136.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177 2019-05-30 11:29:19 -07:00
adis16260.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
adxrs450.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177 2019-05-30 11:29:19 -07: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 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
bmg160_i2c.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
bmg160_spi.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
fxas21002c.h iio: gyro: add core driver for fxas21002c 2019-04-22 11:34:09 +01:00
fxas21002c_core.c iio: gyro: add core driver for fxas21002c 2019-04-22 11:34:09 +01:00
fxas21002c_i2c.c iio: gyro: fxas21002c: add i2c driver 2019-04-22 11:34:12 +01:00
fxas21002c_spi.c iio: gyro: fxas21002c: add spi driver 2019-04-22 11:34:12 +01:00
hid-sensor-gyro-3d.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
itg3200_buffer.c iio:gyro:itg3200: Fix timestamp alignment and prevent data leak. 2020-11-05 11:43:30 +01:00
itg3200_core.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
mpu3050-core.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
mpu3050-i2c.c treewide: Add SPDX license identifier for more missed files 2019-05-21 10:50:45 +02:00
mpu3050.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ssp_gyro_sensor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
st_gyro.h iio:gyro: introduce st_gyro_get_settings() function 2019-07-27 22:52:05 +01:00
st_gyro_buffer.c iio:st_sensors: remove buffer allocation at each buffer enable 2019-08-11 09:26:04 +01:00
st_gyro_core.c iio: st_gyro: Correct data for LSM9DS0 gyro 2020-02-01 09:34:36 +00:00
st_gyro_i2c.c iio: make st_sensors drivers use regmap 2019-07-27 22:52:06 +01:00
st_gyro_spi.c iio: move 3-wire spi initialization to st_sensors_spi 2019-07-27 22:52:06 +01:00