Skip to content

Commit 4cd140b

Browse files
Stefan Windfeldt-PrytzJonathan Cameron
authored andcommitted
iio: buffer: check if a buffer has been set up when poll is called
If no iio buffer has been set up and poll is called return 0. Without this check there will be a null pointer dereference when calling poll on a iio driver without an iio buffer. Cc: stable@vger.kernel.org Signed-off-by: Stefan Windfeldt-Prytz <stefan.windfeldt@axis.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent f027e0b commit 4cd140b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/iio/industrialio-buffer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ unsigned int iio_buffer_poll(struct file *filp,
175175
struct iio_dev *indio_dev = filp->private_data;
176176
struct iio_buffer *rb = indio_dev->buffer;
177177

178-
if (!indio_dev->info)
178+
if (!indio_dev->info || rb == NULL)
179179
return 0;
180180

181181
poll_wait(filp, &rb->pollq, wait);

0 commit comments

Comments
 (0)