Skip to content

Commit 592532a

Browse files
nanovimvireshk
authored andcommitted
cpufreq/longhaul: handle NULL policy in longhaul_exit
longhaul_exit() was calling cpufreq_cpu_get(0) without checking for a NULL policy pointer. On some systems, this could lead to a NULL dereference and a kernel warning or panic. This patch adds a check using unlikely() and returns early if the policy is NULL. Bugzilla: #219962 Signed-off-by: Dennis Beier <nanovim@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 7bc0084 commit 592532a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/cpufreq/longhaul.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,9 @@ static void __exit longhaul_exit(void)
953953
struct cpufreq_policy *policy = cpufreq_cpu_get(0);
954954
int i;
955955

956+
if (unlikely(!policy))
957+
return;
958+
956959
for (i = 0; i < numscales; i++) {
957960
if (mults[i] == maxmult) {
958961
struct cpufreq_freqs freqs;

0 commit comments

Comments
 (0)