From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: gregkh@linuxfoundation.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, arnd@arndb.de
Subject: Re: [PATCH v2] misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe()
Date: Mon, 11 May 2020 17:57:25 -0700 [thread overview]
Message-ID: <20200512005725.GA57962@builder.lan> (raw)
In-Reply-To: <20200511162722.2552-1-srinivas.kandagatla@linaro.org>
On Mon 11 May 09:27 PDT 2020, Srinivas Kandagatla wrote:
> fastrpc_channel_ctx is not freed if misc_register() fails, this would
> lead to a memory leak. Fix this leak by adding kfree in misc_register()
> error path.
>
> Fixes: 278d56f970ae ("misc: fastrpc: Reference count channel context")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> Changes since v1:
> - Update subject as suggested
> - added fixes tag
>
> drivers/misc/fastrpc.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index c562e285e0f4..07065728e39f 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1615,8 +1615,10 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
> domains[domain_id]);
> data->miscdev.fops = &fastrpc_fops;
> err = misc_register(&data->miscdev);
> - if (err)
> + if (err) {
> + kfree(data);
> return err;
> + }
>
> kref_init(&data->refcount);
>
> --
> 2.21.0
>
prev parent reply other threads:[~2020-05-12 0:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 16:27 [PATCH v2] misc: fastrpc: Fix an incomplete memory release in fastrpc_rpmsg_probe() Srinivas Kandagatla
2020-05-12 0:57 ` Bjorn Andersson [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=20200512005725.GA57962@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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.