cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
Subsystems (2)
PATCH 1/1 cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_work_fn
The patch avoids allocating cpufreq_policy on stack hence fixing frame size overflow in 'powernv_cpufreq_work_fn'
--- drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/cpufreq/powernv-cpufreq.c +8 -5
@@ -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 ();
Signature · 1 line
2.24.1
Hi Pratik,
Thanks.
I have checked:
- for matching puts/gets
- that all the '.' to '->' conversions, aud uses of '&' check out
- that the Snowpatch checks pass (https://patchwork.ozlabs.org/patch/1255580/)
On that basis:
Regards,
Daniel
Quoted 43 lines
The patch avoids allocating
cpufreq_policyon 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 <[email protected]>--- drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/cpufreq/powernv-cpufreq.c +8
-5@@ -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 ();Signature · 1 line
2.24.1
Quoted 5 lines · CET Pratik Rajesh Sampat
The patch avoids allocating
cpufreq_policyon 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 <[email protected]>
Any objections or concerns here?
If not, I'll queue it up.
Quoted 37 lines
--- drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/cpufreq/powernv-cpufreq.c +8
-5@@ -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 ();
Quoted 3 lines · Pratik Rajesh Sampat
The patch avoids allocating
cpufreq_policyon stack hence fixing frame size overflow in 'powernv_cpufreq_work_fn'
Thanks for fixing this.
Quoted 2 lines
Fixes 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling")Signed-off-by Pratik Rajesh Sampat <[email protected]>
Quoted 39 lines
--- drivers/cpufreq/powernv-cpufreq.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/cpufreq/powernv-cpufreq.c +8
-5@@ -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 ();Signature · 1 line
2.24.1
Michael Ellerman
reviewerQuoted 10 lines · Rafael J. Wysocki
Quoted 5 lines · CET Pratik Rajesh Sampat
The patch avoids allocating
cpufreq_policyon 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 <[email protected]>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
Quoted 33 lines
Quoted 33 lines
drivers/cpufreq/powernv-cpufreq.c +8
-5@@ -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 ();
Quoted 5 lines · CET Michael Ellerman
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · CET Pratik Rajesh Sampat
The patch avoids allocating
cpufreq_policyon stack hence fixing frame size overflow in 'powernv_cpufreq_work_fn'
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Fixes 227942809b52 ("cpufreq: powernv: Restore cpu frequency to policy->cur on unthrottling")Signed-off-by Pratik Rajesh Sampat <[email protected]>Any objections or concerns here?
If not, I'll queue it up.
I have it in my testing branch,
Great!
Quoted 1 line
but if you pick it up I can drop it.
Let it go in through your tree.
Cheers!
Michael Ellerman
AppliedQuoted 5 lines · Pratik Rajesh Sampat
The patch avoids allocating
cpufreq_policyon 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 <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/d95fe371ecd28901f11256c610b988ed44e36ee2
cheers