iio: buffer: check if a buffer has been set up when poll is called
PATCH v2 1/1 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.
Signed-off-by Stefan Windfeldt-Prytz <[email protected]>
---
Changes in v2:
- Removed Change-Id
drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/industrialio-buffer.c +1 -1
@@ -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);
Signature · 1 line
2.1.4
Quoted 2 lines · Stefan Windfeldt-Prytz
If no iio buffer has been set up and poll is called return 0.
This is a pretty bad bug, thanks for fixing this.
The commit message should include a section about the consequences of missing check.
It looks like the issue goes back all the way to the beginning and the fix needs to be backported to all stable releases.
Quoted 22 lines
Signed-off-by Stefan Windfeldt-Prytz <[email protected]>---
Changes in v2:
- Removed Change-Iddrivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/industrialio-buffer.c +1
-1@@ -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);