mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
7b6b51234d
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 array in the iio_priv() data with alignment
explicitly requested. This data is allocated with kzalloc() so no
data can leak apart from previous readings.
In this driver, depending on which channels are enabled, the timestamp
can be in a number of locations. Hence we cannot use a structure
to specify the data layout without it being misleading.
Fixes:
|
||
---|---|---|
.. | ||
bmi160 | ||
inv_icm42600 | ||
inv_mpu6050 | ||
st_lsm6dsx | ||
adis16400.c | ||
adis16460.c | ||
adis16475.c | ||
adis16480.c | ||
adis_buffer.c | ||
adis_trigger.c | ||
adis.c | ||
fxos8700_core.c | ||
fxos8700_i2c.c | ||
fxos8700_spi.c | ||
fxos8700.h | ||
Kconfig | ||
kmx61.c | ||
Makefile |