From: Jonathan Cameron <jic23@kernel.org>
To: Stefan Windfeldt-Prytz <stefan.windfeldt@axis.com>
Cc: knaack.h@gmx.de, lars@metafoo.de, ppmeerw@pmeerw.net,
linux-iio@vger.kernel.org,
Stefan Windfeldt-Prytz <stefanw@axis.com>
Subject: Re: [PATCHv3] iio: buffer: check if a buffer has been set up when poll is called
Date: Sat, 17 Feb 2018 16:56:11 +0000 [thread overview]
Message-ID: <20180217165611.24c7f92c@archlinux> (raw)
In-Reply-To: <1518703373-23687-1-git-send-email-stefan.windfeldt@axis.com>
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);
prev parent reply other threads:[~2018-02-17 16:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 14:02 [PATCHv3] iio: buffer: check if a buffer has been set up when poll is called Stefan Windfeldt-Prytz
2018-02-17 16:56 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180217165611.24c7f92c@archlinux \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=ppmeerw@pmeerw.net \
--cc=stefan.windfeldt@axis.com \
--cc=stefanw@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.