1
0
Fork 0
alistair23-linux/drivers/iio/light
Jonathan Cameron 71a326dcd2 iio:light:st_uvis25: Fix timestamp alignment and prevent data leak.
commit d837a996f5 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()

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

A local unsigned int variable is used for the regmap call so it
is clear there is no potential issue with writing into the padding
of the structure.

Fixes: 3025c8688c ("iio: light: add support for UVIS25 sensor")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200920112742.170751-3-jic23@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-30 11:51:44 +01:00
..
Kconfig iio: light: fix kconfig dependency bug for VCNL4035 2020-11-24 13:29:21 +01:00
Makefile iio: light: noa1305: Add support for NOA1305 2019-08-05 17:24:18 +01:00
acpi-als.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
adjd_s311.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
al3320a.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
apds9300.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
apds9960.c iio: light: apds9960: Fix a typo 2019-07-27 20:11:18 +01:00
bh1750.c iio: light: bh1750: Resolve compiler warning and make code more readable 2019-12-31 16:42:48 +01:00
bh1780.c Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
cm3232.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cm3323.c iio: light: cm3323: Use device-managed APIs 2019-08-05 14:54:15 +01:00
cm3605.c
cm32181.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
cm36651.c iio: light: cm36651: convert to i2c_new_dummy_device 2019-07-27 22:52:07 +01:00
cros_ec_light_prox.c chrome platform changes for v5.4 2019-09-19 14:14:28 -07:00
gp2ap020a00f.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
hid-sensor-als.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
hid-sensor-prox.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 309 2019-06-05 17:37:04 +02:00
isl29018.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
isl29028.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
isl29125.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
jsa1212.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
lm3533-als.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ltr501.c iio:light:ltr501 Fix timestamp alignment issue. 2020-09-17 13:47:50 +02:00
lv0104cs.c
max44000.c iio:light:max44000 Fix timestamp alignment and prevent data leak. 2020-09-17 13:47:51 +02:00
max44009.c
noa1305.c iio:light:noa1305: Fix missing break statement. 2019-08-14 09:37:36 +02:00
opt3001.c iio: light: opt3001: fix mutex unlock race 2019-10-09 19:11:29 +01:00
pa12203001.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
rpr0521.c iio:light:rpr0521: Fix timestamp alignment and prevent data leak. 2020-12-30 11:51:44 +01:00
si1133.c iio: si1133: read 24-bit signed integer for measurement 2020-04-23 10:36:43 +02:00
si1145.c iio:light:si1145: Fix timestamp alignment and prevent data leak. 2020-11-05 11:43:29 +01:00
st_uvis25.h iio:light:st_uvis25: Fix timestamp alignment and prevent data leak. 2020-12-30 11:51:44 +01:00
st_uvis25_core.c iio:light:st_uvis25: Fix timestamp alignment and prevent data leak. 2020-12-30 11:51:44 +01:00
st_uvis25_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177 2019-05-30 11:29:19 -07:00
st_uvis25_spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177 2019-05-30 11:29:19 -07:00
stk3310.c iio: light: stk3310: Add device tree support 2019-07-27 20:11:15 +01:00
tcs3414.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
tcs3472.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
tsl2563.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
tsl2583.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
tsl2772.c iio: tsl2772: Use regulator_bulk_() APIs 2019-08-05 16:33:21 +01:00
tsl4531.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
us5182d.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 488 2019-06-19 17:09:52 +02:00
vcnl4000.c iio: vcnl4000: Fix i2c swapped word reading. 2020-06-10 20:24:56 +02:00
vcnl4035.c
veml6070.c iio: light: veml6070: convert to i2c_new_dummy_device 2019-07-27 22:52:07 +01:00
vl6180.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
zopt2201.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00