linux/drivers/iio/chemical
Jonathan Cameron eb1a148ef4 iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
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 an array of smaller elements on the stack.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here.  We close both issues by
moving to a suitable structure in the iio_priv() data with alignment
explicitly requested.  This data is allocated with kzalloc so no
data can leak appart from previous readings.

The explicit alignment of ts is necessary to ensure consistent
padding for x86_32 in which the ts would otherwise be 4 byte aligned.

Fixes: 283d26917a ("iio: chemical: ccs811: Add triggered buffer support")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <Stable@vger.kernel.org>
2020-08-22 11:38:55 +01:00
..
ams-iaq-core.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
atlas-ezo-sensor.c iio: remove left-over parent assignments 2020-06-14 11:50:04 +01:00
atlas-sensor.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
bme680_core.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
bme680_i2c.c iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
bme680_spi.c iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
bme680.h iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
ccs811.c iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-08-22 11:38:55 +01:00
Kconfig iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
Makefile iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
pms7003.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
scd30_core.c iio: chemical: scd30: add core driver 2020-06-27 14:46:44 +01:00
scd30_i2c.c iio: chemical: scd30: add I2C interface driver 2020-06-27 14:50:30 +01:00
scd30_serial.c iio: chemical: scd30: add serial interface driver 2020-06-27 14:52:38 +01:00
scd30.h iio: chemical: scd30: add core driver 2020-06-27 14:46:44 +01:00
sgp30.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
sps30.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
vz89x.c iio: remove left-over parent assignments 2020-06-14 11:50:04 +01:00