Commit 5fbbb90d authored by Jon Medhurst (Tixy)'s avatar Jon Medhurst (Tixy) Committed by Rafael J. Wysocki

cpuidle: Prevent null pointer dereference in cpuidle_coupled_cpu_notify

When a kernel is built to support multiple hardware types it's possible
that CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is set but the hardware the
kernel is run on doesn't support cpuidle and therefore doesn't load a
driver for it. In this case, when the system is shut down,
cpuidle_coupled_cpu_notify() gets called with cpuidle_devices set to
NULL. There are quite possibly other circumstances where this
situation can also occur and we should check for it.
Signed-off-by: default avatarJon Medhurst <tixy@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent 63c6ba43
...@@ -693,7 +693,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb, ...@@ -693,7 +693,7 @@ static int cpuidle_coupled_cpu_notify(struct notifier_block *nb,
mutex_lock(&cpuidle_lock); mutex_lock(&cpuidle_lock);
dev = per_cpu(cpuidle_devices, cpu); dev = per_cpu(cpuidle_devices, cpu);
if (!dev->coupled) if (!dev || !dev->coupled)
goto out; goto out;
switch (action & ~CPU_TASKS_FROZEN) { switch (action & ~CPU_TASKS_FROZEN) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment