summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-10-28 02:15:49 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2017-10-28 02:15:49 +0200
commit02c7dfc006a6e3f4a169f98b8f6c5703756d0072 (patch)
treeb1a092562fc33304e1e798b7fef5c75b48a39b59 /arch
parentMerge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff)
parentperf/x86/intel/bts: Fix exclusive event reference leak (diff)
downloadlinux-02c7dfc006a6e3f4a169f98b8f6c5703756d0072.tar.xz
linux-02c7dfc006a6e3f4a169f98b8f6c5703756d0072.zip
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fix from Ingo Molnar: "A fix for a misplaced permission check that can leave perf PT or LBR disabled (on Intel CPUs) permanently until the next reboot" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel/bts: Fix exclusive event reference leak
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/events/intel/bts.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c
index 16076eb34699..141e07b06216 100644
--- a/arch/x86/events/intel/bts.c
+++ b/arch/x86/events/intel/bts.c
@@ -546,9 +546,6 @@ static int bts_event_init(struct perf_event *event)
if (event->attr.type != bts_pmu.type)
return -ENOENT;
- if (x86_add_exclusive(x86_lbr_exclusive_bts))
- return -EBUSY;
-
/*
* BTS leaks kernel addresses even when CPL0 tracing is
* disabled, so disallow intel_bts driver for unprivileged
@@ -562,6 +559,9 @@ static int bts_event_init(struct perf_event *event)
!capable(CAP_SYS_ADMIN))
return -EACCES;
+ if (x86_add_exclusive(x86_lbr_exclusive_bts))
+ return -EBUSY;
+
ret = x86_reserve_hardware();
if (ret) {
x86_del_exclusive(x86_lbr_exclusive_bts);