]> git.baikalelectronics.ru Git - kernel.git/commit
ACPI: processor: Avoid NULL pointer dereferences at init time
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 Oct 2019 17:35:20 +0000 (19:35 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 16 Oct 2019 11:02:45 +0000 (13:02 +0200)
commit2f26b6503650e8e1fcea30a970e6e5c038e1b35d
tree278bb10df8488575ff7e8fb9d52cd09ebeda2180
parent0b7feb143aa63c75b03e99202c405018f39bfb01
ACPI: processor: Avoid NULL pointer dereferences at init time

If there are neither processor objects nor processor device objects
in the ACPI tables, the per-CPU processors table will not be
initialized and attempting to dereference pointers from there will
cause the kernel to crash.  This happens in acpi_processor_ppc_init()
and acpi_thermal_cpufreq_init() after commit a2c9b828b34c ("ACPI:
cpufreq: Switch to QoS requests instead of cpufreq notifier")
which didn't add the requisite NULL pointer checks in there.

Add the NULL pointer checks to acpi_processor_ppc_init() and
acpi_thermal_cpufreq_init(), and to the corresponding "exit"
routines.

While at it, drop redundant return instructions from
acpi_processor_ppc_init() and acpi_thermal_cpufreq_init().

Fixes: a2c9b828b34c ("ACPI: cpufreq: Switch to QoS requests instead of cpufreq notifier")
Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c