cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn

[ Upstream commit d95fe371ecd28901f11256c610b988ed44e36ee2 ]

The patch avoids allocating cpufreq_policy on stack hence fixing frame
size overflow in 'powernv_cpufreq_work_fn'

Fixes: 227942809b ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling")
Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200316135743.57735-1-psampat@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Pratik Rajesh Sampat 2020-03-16 19:27:43 +05:30 committed by Greg Kroah-Hartman
parent 9a1d2d2ead
commit 68aaf03936

View file

@ -903,6 +903,7 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {
void powernv_cpufreq_work_fn(struct work_struct *work) void powernv_cpufreq_work_fn(struct work_struct *work)
{ {
struct chip *chip = container_of(work, struct chip, throttle); struct chip *chip = container_of(work, struct chip, throttle);
struct cpufreq_policy *policy;
unsigned int cpu; unsigned int cpu;
cpumask_t mask; cpumask_t mask;
@ -917,12 +918,14 @@ void powernv_cpufreq_work_fn(struct work_struct *work)
chip->restore = false; chip->restore = false;
for_each_cpu(cpu, &mask) { for_each_cpu(cpu, &mask) {
int index; int index;
struct cpufreq_policy policy;
cpufreq_get_policy(&policy, cpu); policy = cpufreq_cpu_get(cpu);
index = cpufreq_table_find_index_c(&policy, policy.cur); if (!policy)
powernv_cpufreq_target_index(&policy, index); continue;
cpumask_andnot(&mask, &mask, policy.cpus); index = cpufreq_table_find_index_c(policy, policy->cur);
powernv_cpufreq_target_index(policy, index);
cpumask_andnot(&mask, &mask, policy->cpus);
cpufreq_cpu_put(policy);
} }
out: out:
put_online_cpus(); put_online_cpus();