Skip to content

Commit 4cd140b

Browse files
Stefan Windfeldt-Prytzjic23
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: [email protected] Signed-off-by: Stefan Windfeldt-Prytz <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent f027e0b commit 4cd140b

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)