kernel-fxtec-pro1x/drivers/iio/chemical
Jonathan Cameron 9f67ad0fa7 iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
commit eb1a148ef41d8ae8d9201efc3f1b145976290331 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 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-17 13:45:28 +02:00
..
ams-iaq-core.c iio: add SPDX identifier for various drivers 2018-02-18 11:55:19 +00:00
atlas-ph-sensor.c iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius 2019-02-15 08:10:10 +01:00
bme680.h iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +02:00
bme680_core.c iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +02:00
bme680_i2c.c iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +02:00
bme680_spi.c iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +02:00
ccs811.c iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-09-17 13:45:28 +02:00
Kconfig iio: chemical: Add support for Bosch BME680 sensor 2018-07-28 11:38:46 +01:00
Makefile iio: chemical: Add support for Bosch BME680 sensor 2018-07-28 11:38:46 +01:00
vz89x.c iio: add SPDX identifier for various drivers 2018-02-18 11:55:19 +00:00