This is a note to let you know that I've just added the patch titled PM / devfreq: Fix kernel panic with cpu based scaling to passive gov to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pm-devfreq-fix-kernel-panic-with-cpu-based-scaling-t.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f88a95b0eed454c5ae1dd276270a92bbdcd276e9 Author: Christian Marangi <ansuelsmth@xxxxxxxxx> Date: Tue Jun 14 13:06:59 2022 +0200 PM / devfreq: Fix kernel panic with cpu based scaling to passive gov [ Upstream commit 57e00b40033a376de3f3cf0bb9bf7590d2dd679d ] The cpufreq passive register notifier can PROBE_DEFER and the devfreq struct is freed and then reallocaed on probe retry. The current logic assume that the code can't PROBE_DEFER so the devfreq struct in the this variable in devfreq_passive_data is assumed to be (if already set) always correct. This cause kernel panic as the code try to access the wrong address. To correctly handle this, update the this variable in devfreq_passive_data to the devfreq reallocated struct. Fixes: a03dacb0316f ("PM / devfreq: Add cpu based scaling support to passive governor") Signed-off-by: Christian 'Ansuel' Marangi <ansuelsmth@xxxxxxxxx> Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c index c516d3733267..f06d9b6b96b5 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -363,8 +363,7 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq, if (!p_data) return -EINVAL; - if (!p_data->this) - p_data->this = devfreq; + p_data->this = devfreq; switch (event) { case DEVFREQ_GOV_START: