Message ID | 1518703373-23687-1-git-send-email-stefan.windfeldt@axis.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, 15 Feb 2018 15:02:53 +0100 Stefan Windfeldt-Prytz <stefan.windfeldt@axis.com> wrote: > 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> Applied to the fixes-togreg-post-rc1 branch of iio.git. Thanks, Jonathan > --- > Changes in v3: > - Added consequences of missing the check > > drivers/iio/industrialio-buffer.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c > index 79abf70..cd5bfe3 100644 > --- a/drivers/iio/industrialio-buffer.c > +++ b/drivers/iio/industrialio-buffer.c > @@ -175,7 +175,7 @@ __poll_t 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); -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index 79abf70..cd5bfe3 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -175,7 +175,7 @@ __poll_t 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);
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> --- Changes in v3: - Added consequences of missing the check drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)