summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorXiao Liang <xiliang@redhat.com>2018-01-22 14:12:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-31 14:03:49 +0100
commit34c1acc2f7f5c26e8d0cd2f0b5eba8bd06d8e0b2 (patch)
tree272168b7219782065b0d688fe33bd112b13d5db8 /arch
parent74026a188fe7f8739fbd9f6a960a1486ce6f9c96 (diff)
downloadlinux-stable-34c1acc2f7f5c26e8d0cd2f0b5eba8bd06d8e0b2.tar.gz
linux-stable-34c1acc2f7f5c26e8d0cd2f0b5eba8bd06d8e0b2.tar.bz2
linux-stable-34c1acc2f7f5c26e8d0cd2f0b5eba8bd06d8e0b2.zip
perf/x86/amd/power: Do not load AMD power module on !AMD platforms
commit 40d4071ce2d20840d224b4a77b5dc6f752c9ab15 upstream. The AMD power module can be loaded on non AMD platforms, but unload fails with the following Oops: BUG: unable to handle kernel NULL pointer dereference at (null) IP: __list_del_entry_valid+0x29/0x90 Call Trace: perf_pmu_unregister+0x25/0xf0 amd_power_pmu_exit+0x1c/0xd23 [power] SyS_delete_module+0x1a8/0x2b0 ? exit_to_usermode_loop+0x8f/0xb0 entry_SYSCALL_64_fastpath+0x20/0x83 Return -ENODEV instead of 0 from the module init function if the CPU does not match. Fixes: c7ab62bfbe0e ("perf/x86/amd/power: Add AMD accumulated power reporting mechanism") Signed-off-by: Xiao Liang <xiliang@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20180122061252.6394-1-xiliang@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/events/amd/power.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c
index a6eee5ac4f58..2aefacf5c5b2 100644
--- a/arch/x86/events/amd/power.c
+++ b/arch/x86/events/amd/power.c
@@ -277,7 +277,7 @@ static int __init amd_power_pmu_init(void)
int ret;
if (!x86_match_cpu(cpu_match))
- return 0;
+ return -ENODEV;
if (!boot_cpu_has(X86_FEATURE_ACC_POWER))
return -ENODEV;