[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180226201559.147172835@linuxfoundation.org>
Date:   Mon, 26 Feb 2018 21:16:09 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org,
        Stefan Windfeldt-Prytz <stefan.windfeldt@...s.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: [PATCH 4.4 09/22] iio: buffer: check if a buffer has been set up when poll is called
4.4-stable review patch.  If anyone has any objections, please let me know.
------------------
From: Stefan Windfeldt-Prytz <stefan.windfeldt@...s.com>
commit 4cd140bda6494543f1c1b0ccceceaa44b676eef6 upstream.
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@...r.kernel.org
Signed-off-by: Stefan Windfeldt-Prytz <stefan.windfeldt@...s.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
 drivers/iio/industrialio-buffer.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/iio/industrialio-buffer.c
+++ b/drivers/iio/industrialio-buffer.c
@@ -174,7 +174,7 @@ unsigned int iio_buffer_poll(struct file
 	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);
Powered by blists - more mailing lists
 
