lkml.org 
[lkml]   [2020]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
Date
"Rafael J. Wysocki" <rjw@rjwysocki.net> writes:
> On Monday, March 16, 2020 2:57:43 PM CET Pratik Rajesh Sampat wrote:
>> The patch avoids allocating cpufreq_policy on stack hence fixing frame
>> size overflow in 'powernv_cpufreq_work_fn'
>>
>> Fixes: 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling")
>> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>
>
> Any objections or concerns here?
>
> If not, I'll queue it up.

I have it in my testing branch, but if you pick it up I can drop it.

cheers

>> diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c
>> index 56f4bc0d209e..20ee0661555a 100644
>> --- a/drivers/cpufreq/powernv-cpufreq.c
>> +++ b/drivers/cpufreq/powernv-cpufreq.c
>> @@ -902,6 +902,7 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {
>> void powernv_cpufreq_work_fn(struct work_struct *work)
>> {
>> struct chip *chip = container_of(work, struct chip, throttle);
>> + struct cpufreq_policy *policy;
>> unsigned int cpu;
>> cpumask_t mask;
>>
>> @@ -916,12 +917,14 @@ void powernv_cpufreq_work_fn(struct work_struct *work)
>> chip->restore = false;
>> for_each_cpu(cpu, &mask) {
>> int index;
>> - struct cpufreq_policy policy;
>>
>> - cpufreq_get_policy(&policy, cpu);
>> - index = cpufreq_table_find_index_c(&policy, policy.cur);
>> - powernv_cpufreq_target_index(&policy, index);
>> - cpumask_andnot(&mask, &mask, policy.cpus);
>> + policy = cpufreq_cpu_get(cpu);
>> + if (!policy)
>> + continue;
>> + 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:
>> put_online_cpus();
>>

\
 
 \ /
  Last update: 2020-03-24 07:35    [W:0.111 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site