From: Sricharan R <sricharan@codeaurora.org>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Ohad Ben-Cohen <ohad@wizery.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
linux-remoteproc@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] rpmsg: glink: Fix memory leak in qcom_glink_alloc_intent()
Date: Fri, 8 Sep 2017 16:44:21 +0530 [thread overview]
Message-ID: <4f052d23-b632-2423-7201-a51d8815ea91@codeaurora.org> (raw)
In-Reply-To: <20170908103440.junitv63lrzc5ih5@mwanda>
Hi,
On 9/8/2017 4:04 PM, Dan Carpenter wrote:
> We need to free "intent" and "intent->data" on a couple error paths.
>
> Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
> index fecb1dafa8f3..5dcc9bf1c5bc 100644
> --- a/drivers/rpmsg/qcom_glink_native.c
> +++ b/drivers/rpmsg/qcom_glink_native.c
> @@ -635,19 +635,18 @@ qcom_glink_alloc_intent(struct qcom_glink *glink,
> unsigned long flags;
>
> intent = kzalloc(sizeof(*intent), GFP_KERNEL);
> -
> if (!intent)
> return NULL;
>
> intent->data = kzalloc(size, GFP_KERNEL);
> if (!intent->data)
> - return NULL;
> + goto free_intent;
>
> spin_lock_irqsave(&channel->intent_lock, flags);
> ret = idr_alloc_cyclic(&channel->liids, intent, 1, -1, GFP_ATOMIC);
> if (ret < 0) {
> spin_unlock_irqrestore(&channel->intent_lock, flags);
> - return NULL;
> + goto free_data;
> }
> spin_unlock_irqrestore(&channel->intent_lock, flags);
>
> @@ -656,6 +655,12 @@ qcom_glink_alloc_intent(struct qcom_glink *glink,
> intent->reuse = reuseable;
>
> return intent;
> +
> +free_data:
> + kfree(intent->data);
> +free_intent:
> + kfree(intent);
> + return NULL;
Acked-by: Sricharan R <sricharan@codeaurora.org>
Regards,
Sricharan
--
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
next prev parent reply other threads:[~2017-09-08 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 10:33 [PATCH 1/2] rpmsg: glink: Unlock on error in qcom_glink_request_intent() Dan Carpenter
2017-09-08 10:34 ` [PATCH 2/2] rpmsg: glink: Fix memory leak in qcom_glink_alloc_intent() Dan Carpenter
2017-09-08 11:14 ` Sricharan R [this message]
2017-09-08 11:13 ` [PATCH 1/2] rpmsg: glink: Unlock on error in qcom_glink_request_intent() Sricharan R
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=4f052d23-b632-2423-7201-a51d8815ea91@codeaurora.org \
--to=sricharan@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox