]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: pressure: zpa2326: fix information leak in triggered buffer
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 25 Nov 2024 21:16:11 +0000 (22:16 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Dec 2024 17:23:42 +0000 (17:23 +0000)
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: 03b262f2bbf4 ("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>
drivers/iio/pressure/zpa2326.c

index 2adea84f5b4d08d56ed884ad1c80468cc5c1d1a9..9db1c94dfc188f21854c6ec636dd9f37ab391578 100644 (file)
@@ -586,6 +586,8 @@ static int zpa2326_fill_sample_buffer(struct iio_dev               *indio_dev,
        }   sample;
        int err;
 
+       memset(&sample, 0, sizeof(sample));
+
        if (test_bit(0, indio_dev->active_scan_mask)) {
                /* Get current pressure from hardware FIFO. */
                err = zpa2326_dequeue_pressure(indio_dev, &sample.pressure);