Skip to content

Commit 57e00b4

Browse files
Ansuelchanwoochoi
authored andcommitted
PM / devfreq: Fix kernel panic with cpu based scaling to passive gov
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: a03dacb ("PM / devfreq: Add cpu based scaling support to passive governor") Signed-off-by: Christian 'Ansuel' Marangi <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 03c765b commit 57e00b4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/devfreq/governor_passive.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,7 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
407407
if (!p_data)
408408
return -EINVAL;
409409

410-
if (!p_data->this)
411-
p_data->this = devfreq;
410+
p_data->this = devfreq;
412411

413412
switch (event) {
414413
case DEVFREQ_GOV_START:

0 commit comments

Comments
 (0)