mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 01:22:07 +00:00
89deb13342
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 not necessary in this case but
does make the code slightly less fragile so I have included it.
Fixes:
|
||
---|---|---|
.. | ||
ak8974.c | ||
ak8975.c | ||
bmc150_magn_i2c.c | ||
bmc150_magn_spi.c | ||
bmc150_magn.c | ||
bmc150_magn.h | ||
hid-sensor-magn-3d.c | ||
hmc5843_core.c | ||
hmc5843_i2c.c | ||
hmc5843_spi.c | ||
hmc5843.h | ||
Kconfig | ||
mag3110.c | ||
Makefile | ||
mmc35240.c | ||
rm3100-core.c | ||
rm3100-i2c.c | ||
rm3100-spi.c | ||
rm3100.h | ||
st_magn_buffer.c | ||
st_magn_core.c | ||
st_magn_i2c.c | ||
st_magn_spi.c | ||
st_magn.h |