kernel-fxtec-pro1x/drivers/iio
Jonathan Cameron 234974cf05 iio:adc:max1118 Fix alignment of timestamp and data leak issues
commit db8f06d97ec284dc018e2e4890d2e5035fde8630 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.

This data is allocated with kzalloc so no data can leak apart
from previous readings.

The explicit alignment of ts is necessary to ensure correct padding
on architectures where s64 is only 4 bytes aligned such as x86_32.

Fixes: a9e9c7153e ("iio: adc: add max1117/max1118/max1119 ADC driver")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Akinobu Mita <akinobu.mita@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:27 +02:00
..
accel iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak. 2020-09-17 13:45:27 +02:00
adc iio:adc:max1118 Fix alignment of timestamp and data leak issues 2020-09-17 13:45:27 +02:00
afe iio: afe: rescale: new driver 2018-04-28 18:03:22 +01:00
amplifiers iio: amplifiers: ad8366: move channel init before iio_device_register() 2018-05-22 18:13:45 +01:00
buffer iio:kfifo_buf: check for uint overflow 2018-03-30 11:16:12 +01:00
chemical iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +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 iio: 104-quad-8: Provide defines for magic numbers 2018-06-10 11:52:30 +01:00
dac iio: dac: ad5592r: fix unbalanced mutex unlocks in ad5592r_read_raw() 2020-08-21 11:05:31 +02:00
dummy iio:dummy: Add extra paragraphs on Kconfig 2018-03-03 15:20:16 +00:00
frequency Merge branch 'fixes-togreg' into togreg 2018-08-01 18:56:17 +01:00
gyro iio: st_gyro: Correct data for LSM9DS0 gyro 2020-02-01 09:37:04 +00: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:ltr501 Fix timestamp alignment issue. 2020-09-17 13:45:27 +02:00
magnetometer iio: magnetometer: ak8974: Fix runtime PM imbalance on error 2020-07-22 09:32:02 +02:00
multiplexer treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
orientation iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2018-12-05 19:32:13 +01:00
potentiometer iio: potentiometer: mcp4531: switch to using .probe_new 2018-04-15 18:12:51 +01:00
potentiostat iio: potentiostat: lmp91000: add LMP91002 support 2018-05-12 11:02:44 +01:00
pressure iio:pressure:ms5611 Fix buffer element alignment 2020-07-22 09:32:02 +02:00
proximity iio: srf04: fix wrong limitation in distance measuring 2019-11-12 19:20:40 +01:00
resolver staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00
temperature iio: temperature: mlx90632 Relax the compatibility check 2019-06-25 11:35:54 +08:00
trigger iio: trigger: stm32-timer: disable master mode when stopping 2020-03-25 08:06:10 +01:00
iio_core.h the rest of drivers/*: annotate ->poll() instances 2017-11-28 11:06:58 -05:00
iio_core_trigger.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 iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-core.c iio: core: fix a possible circular locking dependency 2019-04-27 09:36:35 +02:00
industrialio-event.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
industrialio-sw-device.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-sw-trigger.c iio: make function argument and some structures const 2017-10-19 16:15:24 +02:00
industrialio-trigger.c iio:trigger: Remove necessity to have a trig->ops structure. 2017-08-22 21:20:28 +01:00
industrialio-triggered-event.c
inkern.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
Kconfig staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00
Makefile staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00