Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

Commit 9dc4030

Browse files
Stefan Windfeldt-Prytzgregkh
authored andcommitted
iio: buffer: check if a buffer has been set up when poll is called
commit 4cd140b upstream. 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: [email protected] Signed-off-by: Stefan Windfeldt-Prytz <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1b985a6 commit 9dc4030

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)