1
0
Fork 0
alistair23-linux/drivers/iio/chemical
Jonathan Cameron b040ac56b2 iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.
commit eb1a148ef4 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:47:51 +02:00
..
Kconfig iio: chemical: sps30: fix missing triggered buffer dependency 2020-03-25 08:25:53 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +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-01-12 17:06:49 +00:00
bme680.h iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00:00
bme680_core.c iio:chemical:bme680: Fix SPI read interface 2019-03-09 17:27:36 +00: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
ccs811.c iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:51 +02:00
pms7003.c iio:chemical:pms7003: Fix timestamp alignment and prevent data leak. 2020-06-10 20:24:56 +02:00
sgp30.c iio: chemical: sgp30: Support Sensirion SGP30/SGPC3 sensors 2018-12-16 14:05:58 +00:00
sps30.c iio:chemical:sps30: Fix timestamp alignment 2020-06-10 20:24:56 +02:00
vz89x.c iio: add SPDX identifier for various drivers 2018-02-18 11:55:19 +00:00