From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933510AbeAXMFT (ORCPT ); Wed, 24 Jan 2018 07:05:19 -0500 Received: from terminus.zytor.com ([65.50.211.136]:47047 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932953AbeAXMFS (ORCPT ); Wed, 24 Jan 2018 07:05:18 -0500 Date: Wed, 24 Jan 2018 04:04:09 -0800 From: tip-bot for Xiao Liang Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, xiliang@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, xiliang@redhat.com, mingo@kernel.org In-Reply-To: <20180122061252.6394-1-xiliang@redhat.com> References: <20180122061252.6394-1-xiliang@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms Git-Commit-ID: 40d4071ce2d20840d224b4a77b5dc6f752c9ab15 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 40d4071ce2d20840d224b4a77b5dc6f752c9ab15 Gitweb: https://git.kernel.org/tip/40d4071ce2d20840d224b4a77b5dc6f752c9ab15 Author: Xiao Liang AuthorDate: Mon, 22 Jan 2018 14:12:52 +0800 Committer: Thomas Gleixner CommitDate: Wed, 24 Jan 2018 13:00:35 +0100 perf/x86/amd/power: Do not load AMD power module on !AMD platforms 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 Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20180122061252.6394-1-xiliang@redhat.com --- arch/x86/events/amd/power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c index a6eee5a..2aefacf 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;