From 0ffc7534a210105ba973167a5b86d5ab39d4031f Mon Sep 17 00:00:00 2001 From: Tristan Madani Date: Mon, 19 Oct 2026 22:26:35 +0000 Subject: [PATCH] cpufreq: intel_pstate: cancel HWP notify work in driver cleanup intel_pstate_driver_cleanup() frees per-CPU data without cancelling the pending HWP notify delayed work. If hwp_notify_work is still scheduled or running when the struct is freed, the work function accesses freed memory via container_of(). Call intel_pstate_disable_hwp_interrupt() before kfree() to disable the interrupt source and cancel the pending work, matching the pattern used in intel_pstate_suspend() and intel_pstate_hwp_offline(). Fixes: d845cd901b28 ("cpufreq: intel_pstate: Support highest performance change interrupt") Cc: All applicable Signed-off-by: Tristan Madani [ rjw: Fixed the Fixes: tag ] Link: https://patch.msgid.link/20261019222635.1741146-1-tristmd@gmail.com Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 17158cb25dd8..0e6ae4cdda5d 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -3436,6 +3436,8 @@ static void intel_pstate_driver_cleanup(void) if (intel_pstate_driver == &intel_pstate) intel_pstate_clear_update_util_hook(cpu); + intel_pstate_disable_hwp_interrupt(all_cpu_data[cpu]); + kfree(all_cpu_data[cpu]); WRITE_ONCE(all_cpu_data[cpu], NULL); }