Skip to content

Commit 4aac881

Browse files
Stefan Windfeldt-PrytzSasha Levin
authored andcommitted
iio: buffer: check if a buffer has been set up when poll is called
[ Upstream commit 4cd140b ] 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: Sasha Levin <[email protected]>
1 parent 953eb3c commit 4aac881

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
@@ -150,7 +150,7 @@ unsigned int iio_buffer_poll(struct file *filp,
150150
struct iio_dev *indio_dev = filp->private_data;
151151
struct iio_buffer *rb = indio_dev->buffer;
152152

153-
if (!indio_dev->info)
153+
if (!indio_dev->info || rb == NULL)
154154
return 0;
155155

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

0 commit comments

Comments
 (0)