* [PATCH] PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
@ 2012-10-13 1:58 Jonghwan Choi
2012-10-14 8:06 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Jonghwan Choi @ 2012-10-13 1:58 UTC (permalink / raw)
To: linux-pm, linux-kernel
Cc: 'Pavel Machek', 'Rafael J. Wysocki'
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;
}
--
1.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle
2012-10-13 1:58 [PATCH] PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle Jonghwan Choi
@ 2012-10-14 8:06 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2012-10-14 8:06 UTC (permalink / raw)
To: Jonghwan Choi; +Cc: linux-pm, linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-14 8:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-13 1:58 [PATCH] PM / Domains: Fix memory leak on error path in pm_genpd_attach_cpuidle Jonghwan Choi
2012-10-14 8:06 ` Rafael J. Wysocki
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®