* [PATCH] cpufreq: fix memory leak in cpufreq_add_dev
@ 2010-07-20 12:11 Xiaotian Feng
2010-07-20 12:55 ` Prarit Bhargava
0 siblings, 1 reply; 2+ messages in thread
From: Xiaotian Feng @ 2010-07-20 12:11 UTC (permalink / raw)
To: cpufreq
Cc: linux-kernel, Xiaotian Feng, Dave Jones, Thomas Renninger,
Prarit Bhargava
We didn't free policy->related_cpus in error path err_unlock_policy.
This is catched by following kmemleak report:
unreferenced object 0xffff88022a0b96d0 (size 512):
comm "modprobe", pid 886, jiffies 4294689177 (age 780.694s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff8111ebe5>] create_object+0x186/0x281
[<ffffffff814fad4f>] kmemleak_alloc+0x60/0xa7
[<ffffffff8111127a>] kmem_cache_alloc_node_notrace+0x120/0x142
[<ffffffff81262e4f>] alloc_cpumask_var_node+0x2c/0xd7
[<ffffffff81262f0b>] alloc_cpumask_var+0x11/0x13
[<ffffffff81262f1c>] zalloc_cpumask_var+0xf/0x11
[<ffffffff8140fac0>] cpufreq_add_dev+0x11f/0x547
[<ffffffff81334bda>] sysdev_driver_register+0xc2/0x11d
[<ffffffff8140e334>] cpufreq_register_driver+0xcb/0x1b8
[<ffffffffa032e040>] 0xffffffffa032e040
[<ffffffff810021ba>] do_one_initcall+0x5e/0x15c
[<ffffffff81087f94>] sys_init_module+0xa6/0x1e6
[<ffffffff81009bc2>] system_call_fastpath+0x16/0x1b
[<ffffffffffffffff>] 0xffffffffffffffff
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Prarit Bhargava <prarit@redhat.com>
---
drivers/cpufreq/cpufreq.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 063b218..12263b4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1077,6 +1077,7 @@ err_out_unregister:
err_unlock_policy:
unlock_policy_rwsem_write(cpu);
+ free_cpumask_var(policy->related_cpus);
err_free_cpumask:
free_cpumask_var(policy->cpus);
err_free_policy:
--
1.7.1.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpufreq: fix memory leak in cpufreq_add_dev
2010-07-20 12:11 [PATCH] cpufreq: fix memory leak in cpufreq_add_dev Xiaotian Feng
@ 2010-07-20 12:55 ` Prarit Bhargava
0 siblings, 0 replies; 2+ messages in thread
From: Prarit Bhargava @ 2010-07-20 12:55 UTC (permalink / raw)
To: Xiaotian Feng; +Cc: cpufreq, linux-kernel, Dave Jones, Thomas Renninger
On 07/20/2010 08:11 AM, Xiaotian Feng wrote:
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 063b218..12263b4 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1077,6 +1077,7 @@ err_out_unregister:
>
> err_unlock_policy:
> unlock_policy_rwsem_write(cpu);
> + free_cpumask_var(policy->related_cpus);
> err_free_cpumask:
> free_cpumask_var(policy->cpus);
> err_free_policy:
>
Seems right to me ...
P.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-20 12:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 12:11 [PATCH] cpufreq: fix memory leak in cpufreq_add_dev Xiaotian Feng
2010-07-20 12:55 ` Prarit Bhargava
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).