Re: [PATCH] cpufreq: powernow-k8: Fix possible memory leak in powernowk8_cpu_init()
From: Rafael J. Wysocki (Intel)
Date: Mon Jul 27 2026 - 11:14:24 EST
On Mon, Jul 27, 2026 at 12:39 PM Zhongqiu Han
<zhongqiu.han@xxxxxxxxxxxxxxxx> wrote:
>
> On 7/27/2026 6:20 PM, Viresh Kumar wrote:
> > 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: stable@xxxxxxxxxxxxxxx
> >> Signed-off-by: Abdun Nihaal <nihaal@xxxxxxxxxxxxxx>
> >> ---
> >> 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 <viresh.kumar@xxxxxxxxxx>
> >
>
> Reviewed-by: Zhongqiu Han <zhongqiu.han@xxxxxxxxxxxxxxxx>
Applied as 7.2-rc material, thanks!