Skip to content

Commit 99ef749

Browse files
javiercarrascocruzmehmetb0
authored andcommitted
iio: pressure: zpa2326: fix information leak in triggered buffer
BugLink: https://bugs.launchpad.net/bugs/2097298 commit 6007d10 upstream. The 'sample' local struct is used to push data to user space from a triggered buffer, but it has a hole between the temperature and the timestamp (u32 pressure, u16 temperature, GAP, u64 timestamp). This hole is never initialized. Initialize the struct to zero before using it to avoid pushing uninitialized information to userspace. Cc: stable@vger.kernel.org Fixes: 03b262f ("iio:pressure: initial zpa2326 barometer support") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://patch.msgid.link/20241125-iio_memset_scan_holes-v1-3-0cb6e98d895c@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Noah Wager <noah.wager@canonical.com> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
1 parent 1aa13a8 commit 99ef749

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/pressure/zpa2326.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,8 @@ static int zpa2326_fill_sample_buffer(struct iio_dev *indio_dev,
586586
} sample;
587587
int err;
588588

589+
memset(&sample, 0, sizeof(sample));
590+
589591
if (test_bit(0, indio_dev->active_scan_mask)) {
590592
/* Get current pressure from hardware FIFO. */
591593
err = zpa2326_dequeue_pressure(indio_dev, &sample.pressure);

0 commit comments

Comments
 (0)