Re: [PATCH] cpufreq: powernow-k8: Fix possible memory leak in powernowk8_cpu_init()

Viresh Kumar <[email protected]>
Newsgroups org.kernel.vger.linux-pm,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <5zxdn4jnqu22k2s7roo3wxykwsusah7mp4telybmzlc5zgilac@pf5svblpx7nj>
On 27-07-26, 15:05, Abdun Nihaal wrote:
> The memory allocated for data->powernow_table inside
> powernow_k8_cpu_init_acpi() or find_psb_table() is not freed in one of
> the error paths in powernowk8_cpu_init(). Fix that by adding a kfree().
> 
> Fixes: 1ff6e97f1d99 ("[CPUFREQ] cpumask: avoid playing with cpus_allowed in powernow-k8.c")
> Cc: [email protected]
> Signed-off-by: Abdun Nihaal <[email protected]>
> ---
> Compile tested only. Issue found using static analysis.
> 
>  drivers/cpufreq/powernow-k8.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
> index fe1f499b4fc0..c9bcc6f0ab7b 100644
> --- a/drivers/cpufreq/powernow-k8.c
> +++ b/drivers/cpufreq/powernow-k8.c
> @@ -1085,6 +1085,7 @@ static int powernowk8_cpu_init(struct cpufreq_policy *pol)
>  
>  err_out_exit_acpi:
>  	powernow_k8_cpu_exit_acpi(data);
> +	kfree(data->powernow_table);
>  
>  err_out:
>  	kfree(data);

Acked-by: Viresh Kumar <[email protected]>

-- 
viresh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.