lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 Jan 2013 21:46:03 +0100
From:	Gregory CLEMENT <gregory.clement@...e-electrons.com>
To:	Cong Ding <dinggnu@...il.com>,
	Mike Turquette <mturquette@...aro.org>
CC:	Jason Cooper <jason@...edaemon.net>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	linux-kernel@...r.kernel.org,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v3] clk: mvebu/clk-cpu.c: fix memory leakage

On 01/15/2013 07:44 PM, Cong Ding wrote:
> the variable cpuclk and clk_name should be properly freed when error happens.
Dear Cong Ding,

Thanks for you efforts!
I am happy with this patch and I tested it on the Armada XP DB board, so
you can now add my:

Acked-by: Gregory CLEMENT <gregory.clement@...e-electrons.com>

Mike,

could you take this patch for 3.8-rc fixes?

If you prefer, Jason agrees to take it, but you probably didn't notice it,
because he uses your former(and no more valid) email when he wrote this.

Thanks,

Gregory

> 
> Signed-off-by: Cong Ding <dinggnu@...il.com>
> Acked-by: Jason Cooper <jason@...edaemon.net>
> ---
>  drivers/clk/mvebu/clk-cpu.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/mvebu/clk-cpu.c b/drivers/clk/mvebu/clk-cpu.c
> index ff004578..9dd2551 100644
> --- a/drivers/clk/mvebu/clk-cpu.c
> +++ b/drivers/clk/mvebu/clk-cpu.c
> @@ -124,7 +124,7 @@ void __init of_cpu_clk_setup(struct device_node *node)
>  
>  	clks = kzalloc(ncpus * sizeof(*clks), GFP_KERNEL);
>  	if (WARN_ON(!clks))
> -		return;
> +		goto clks_out;
>  
>  	for_each_node_by_type(dn, "cpu") {
>  		struct clk_init_data init;
> @@ -134,11 +134,11 @@ void __init of_cpu_clk_setup(struct device_node *node)
>  		int cpu, err;
>  
>  		if (WARN_ON(!clk_name))
> -			return;
> +			goto bail_out;
>  
>  		err = of_property_read_u32(dn, "reg", &cpu);
>  		if (WARN_ON(err))
> -			return;
> +			goto bail_out;
>  
>  		sprintf(clk_name, "cpu%d", cpu);
>  		parent_clk = of_clk_get(node, 0);
> @@ -167,6 +167,9 @@ void __init of_cpu_clk_setup(struct device_node *node)
>  	return;
>  bail_out:
>  	kfree(clks);
> +	while(ncpus--)
> +		kfree(cpuclk[ncpus].clk_name);
> +clks_out:
>  	kfree(cpuclk);
>  }
>  
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ