ipq806x: 6.1: copy patches, files and config from 5.15
[openwrt/staging/ldir.git] / target / linux / ipq806x / patches-6.1 / 113-v5.19-02-PM-devfreq-Fix-kernel-panic-with-cpu-based-scaling-t.patch
1 From 57e00b40033a376de3f3cf0bb9bf7590d2dd679d Mon Sep 17 00:00:00 2001
2 From: Christian 'Ansuel' Marangi <ansuelsmth@gmail.com>
3 Date: Tue, 14 Jun 2022 13:06:59 +0200
4 Subject: [PATCH 1/1] PM / devfreq: Fix kernel panic with cpu based scaling to
5 passive gov
6
7 The cpufreq passive register notifier can PROBE_DEFER and the devfreq
8 struct is freed and then reallocaed on probe retry.
9 The current logic assume that the code can't PROBE_DEFER so the devfreq
10 struct in the this variable in devfreq_passive_data is assumed to be
11 (if already set) always correct.
12 This cause kernel panic as the code try to access the wrong address.
13 To correctly handle this, update the this variable in
14 devfreq_passive_data to the devfreq reallocated struct.
15
16 Fixes: a03dacb0316f ("PM / devfreq: Add cpu based scaling support to passive governor")
17 Signed-off-by: Christian 'Ansuel' Marangi <ansuelsmth@gmail.com>
18 Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
19 ---
20 drivers/devfreq/governor_passive.c | 3 +--
21 1 file changed, 1 insertion(+), 2 deletions(-)
22
23 --- a/drivers/devfreq/governor_passive.c
24 +++ b/drivers/devfreq/governor_passive.c
25 @@ -401,8 +401,7 @@ static int devfreq_passive_event_handler
26 if (!p_data)
27 return -EINVAL;
28
29 - if (!p_data->this)
30 - p_data->this = devfreq;
31 + p_data->this = devfreq;
32
33 switch (event) {
34 case DEVFREQ_GOV_START: