From: Xiao Liang <xiliang@redhat.com>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
Xiao Liang <xiliang@redhat.com>
Subject: [PATCH v1 1/1] perf/x86/amd/power: do not load amd power module in intel platform
Date: Mon, 22 Jan 2018 14:12:52 +0800 [thread overview]
Message-ID: <20180122061252.6394-1-xiliang@redhat.com> (raw)
"power" module can be loaded if it is not amd processor.
And user cannot unload it after loaded it. The following call trace generated
when tried to unload it.
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: __list_del_entry_valid+0x29/0x90
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 1 PID: 26046 Comm: modprobe Not tainted 4.14.13-300.fc27.x86_64 #1
Hardware name: Xen HVM domU, BIOS 4.9.1 12/12/2017
task: ffff9a138f8dddc0 task.stack: ffffb0ec41cbc000
RIP: 0010:__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
RIP: 0033:0x7fb67d78e5c7
Signed-off-by: Xiao Liang <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 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;
--
2.14.3
next reply other threads:[~2018-01-22 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 6:12 Xiao Liang [this message]
2018-01-24 12:04 ` [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms tip-bot for Xiao Liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180122061252.6394-1-xiliang@redhat.com \
--to=xiliang@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox