From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Jonghwan Choi <jhbird.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
Date: Sun, 14 Oct 2012 10:06:17 +0200 [thread overview]
Message-ID: <1806891.1aniohUZ1p@vostro.rjw.lan> (raw)
In-Reply-To: <001d01cda8e6$3ec8bda0$bc5a38e0$%choi@samsung.com>
Hi,
Thanks for spotting the problem and for the patch (it got corrupted
in transfer, so please see if the one below is what you meant).
I'll queue it up for v3.7, but I'm travelling now, so it may take a while.
Thanks,
Rafael
> From: jhbird.choi@samsung.com
> Subject: PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
>
> If pm_genpd_attach_cpudidle failed we leak memory stored in 'cpu_data'.
>
> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
> ---
> drivers/base/power/domain.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c22b869..96b71b6 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1862,7 +1862,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
> cpuidle_drv = cpuidle_driver_ref();
> if (!cpuidle_drv) {
> ret = -ENODEV;
> - goto out;
> + goto err_drv;
> }
> if (cpuidle_drv->state_count <= state) {
> ret = -EINVAL;
> @@ -1884,6 +1884,9 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
>
> err:
> cpuidle_driver_unref();
> +
> + err_drv:
> + kfree(cpu_data);
> goto out;
> }
>
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
prev parent reply other threads:[~2012-10-14 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-13 1:58 Jonghwan Choi
2012-10-14 8:06 ` Rafael J. Wysocki [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=1806891.1aniohUZ1p@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=jhbird.choi@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®