From: Jonathan Cameron <jic23@kernel.org>
To: Pan Bian <bianpan2016@163.com>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: iio: dummy_evgen: fix possible memleak in evgen init
Date: Mon, 22 Apr 2019 11:46:28 +0100 [thread overview]
Message-ID: <20190422114628.03ab91a5@archlinux> (raw)
In-Reply-To: <1555556576-6927-1-git-send-email-bianpan2016@163.com>
On Thu, 18 Apr 2019 11:02:56 +0800
Pan Bian <bianpan2016@163.com> wrote:
> The memory allocated in the function iio_dummy_evgen_create is not
> released if it fails to add the evgen device to device hierarchy. This
> may result in a memory leak bug.
>
> Signed-off-by: Pan Bian <bianpan2016@163.com>
Hi. Not sure why the patch doesn't have the standard [PATCH] prefix
in the title.
This issue has been there a long time, but as the driver is only
a testing stub I'm not going to add a fixes tag or mark it for stable.
That would just be noise I think.
Applied to the togreg branch of iio.git and pushed out as testing
for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/dummy/iio_dummy_evgen.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dummy/iio_dummy_evgen.c b/drivers/iio/dummy/iio_dummy_evgen.c
> index efd0005..f96c0a3 100644
> --- a/drivers/iio/dummy/iio_dummy_evgen.c
> +++ b/drivers/iio/dummy/iio_dummy_evgen.c
> @@ -196,7 +196,10 @@ static __init int iio_dummy_evgen_init(void)
> return ret;
> device_initialize(&iio_evgen_dev);
> dev_set_name(&iio_evgen_dev, "iio_evgen");
> - return device_add(&iio_evgen_dev);
> + ret = device_add(&iio_evgen_dev);
> + if (ret)
> + put_device(&iio_evgen_dev);
> + return ret;
> }
> module_init(iio_dummy_evgen_init);
>
prev parent reply other threads:[~2019-04-22 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 3:02 iio: dummy_evgen: fix possible memleak in evgen init Pan Bian
2019-04-22 10:46 ` 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=20190422114628.03ab91a5@archlinux \
--to=jic23@kernel.org \
--cc=bianpan2016@163.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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.