c14edb4d0b
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 an array of suitable structures in the iio_priv() data.
This data is allocated with kzalloc so no data can leak apart from
previous readings.
For the tagged path the data is aligned by using __aligned(8) for
the buffer on the stack.
There has been a lot of churn in this driver, so likely backports
may be needed for stable.
Fixes:
|
||
---|---|---|
.. | ||
Kconfig | ||
Makefile | ||
st_lsm6dsx_buffer.c | ||
st_lsm6dsx_core.c | ||
st_lsm6dsx_i2c.c | ||
st_lsm6dsx_i3c.c | ||
st_lsm6dsx_shub.c | ||
st_lsm6dsx_spi.c | ||
st_lsm6dsx.h |