summaryrefslogtreecommitdiff
path: root/drivers/iio/industrialio-buffer.c
diff options
context:
space:
mode:
authorStefan Windfeldt-Prytz <stefan.windfeldt@axis.com>2018-02-15 17:02:53 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2018-02-17 19:54:58 +0300
commit4cd140bda6494543f1c1b0ccceceaa44b676eef6 (patch)
tree4b97fb5a8a0ba74b829bfcab703716d1ad07868e /drivers/iio/industrialio-buffer.c
parentf027e0b3a774e10302207e91d304bbf99e3a8b36 (diff)
downloadlinux-4cd140bda6494543f1c1b0ccceceaa44b676eef6.tar.xz
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>
Diffstat (limited to 'drivers/iio/industrialio-buffer.c')
-rw-r--r--drivers/iio/industrialio-buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
index eda2a0f1658f..c7499c8bd69f 100644
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -175,7 +175,7 @@ unsigned int iio_buffer_poll(struct file *filp,
struct iio_dev *indio_dev = filp->private_data;
struct iio_buffer *rb = indio_dev->buffer;
- if (!indio_dev->info)
+ if (!indio_dev->info || rb == NULL)
return 0;
poll_wait(filp, &rb->pollq, wait);