From: Jonathan Cameron <jic23@kernel.org>
To: Andi Shyti <andi@etezian.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: core: check 'info' value before registering the device
Date: Sat, 8 Dec 2018 11:07:35 +0000 [thread overview]
Message-ID: <20181208110735.5da28a29@archlinux> (raw)
In-Reply-To: <20181202183031.2471-1-andi@etezian.org>
On Sun, 2 Dec 2018 20:30:31 +0200
Andi Shyti <andi@etezian.org> wrote:
> When the 'info' structure inside indio_dev is left uninitialized,
> a segmentation fault occurs.
>
> Check the 'info' value before using it and if it is equal to
> NULL, return with -EINVAL.
>
> Signed-off-by: Andi Shyti <andi@etezian.org>
Hmm. It would be an impressive level of bug if that one got through
in a driver but paranoia does no harm I suppose.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/industrialio-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index a062cfddc5af..4f5cd9f60870 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -1671,6 +1671,9 @@ int __iio_device_register(struct iio_dev *indio_dev, struct module *this_mod)
> if (ret < 0)
> return ret;
>
> + if (!indio_dev->info)
> + return -EINVAL;
> +
> /* configure elements for the chrdev */
> indio_dev->dev.devt = MKDEV(MAJOR(iio_devt), indio_dev->id);
>
prev parent reply other threads:[~2018-12-08 11:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-02 18:30 [PATCH] iio: core: check 'info' value before registering the device Andi Shyti
2018-12-08 11:07 ` 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=20181208110735.5da28a29@archlinux \
--to=jic23@kernel.org \
--cc=andi@etezian.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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.