powernv_cpufreq_work_fn() invokes powernv_cpufreq_throttle_check()
through an asynchronous IPI. The callback may still be pending or
running after cancel_work_sync() returns in clean_chip_info(), allowing
it to access chips after they have been freed.

Make the IPI synchronous so that the throttle check completes before
the work function returns. This ensures that cancel_work_sync() also
waits for the IPI callback to finish before freeing chips.

Fixes: 86622cb8c57a ("cpufreq: powernv: Free 'chips' on module exit")
---
 drivers/cpufreq/powernv-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/powernv-cpufreq.c 
b/drivers/cpufreq/powernv-cpufreq.c
index 9dee341b407e..42ff23e14095 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -920,7 +920,7 @@ static void powernv_cpufreq_work_fn(struct work_struct 
*work)
        cpus_read_lock();
        cpumask_and(&mask, &chip->mask, cpu_online_mask);
        smp_call_function_any(&mask,
-                             powernv_cpufreq_throttle_check, NULL, 0);
+                             powernv_cpufreq_throttle_check, NULL, 1);
 
        if (!chip->restore)
                goto out;
-- 
2.25.1


Reply via email to