]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cpufreq: CPPC: Fix potential memleak in cppc_cpufreq_cpu_init
authorViresh Kumar <viresh.kumar@linaro.org>
Fri, 18 Jun 2021 08:01:27 +0000 (13:31 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:02:28 +0000 (16:02 +0200)
commitb775383355755885b19d2acef977f1ca132e80a3
tree8c8668a1bf407e34faf00989aba3f7dd913aec3c
parent29cb4c6229201f22f6ce16d6a9fd15f76c001dc0
cpufreq: CPPC: Fix potential memleak in cppc_cpufreq_cpu_init

[ Upstream commit fe2535a44904a77615a3af8e8fd7dafb98fb0e1b ]

It's a classic example of memleak, we allocate something, we fail and
never free the resources.

Make sure we free all resources on policy ->init() failures.

Fixes: a28b2bfc099c ("cppc_cpufreq: replace per-cpu data array with a list")
Tested-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Tested-by: Qian Cai <quic_qiancai@quicinc.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/cppc_cpufreq.c