diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-29 11:32:03 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-29 11:32:03 -0700 |
commit | af17b3aa1fea3a87d81b499b3039a4b76a668d87 (patch) | |
tree | b0bddb32b395b86301054e2690d68233545e2be6 /kernel | |
parent | 82ec752cce8b19b69efcfc96303b2ed33e01fd48 (diff) | |
parent | befb1b3c2703897c5b8ffb0044dc5d0e5f27c5d7 (diff) | |
download | linux-af17b3aa1fea3a87d81b499b3039a4b76a668d87.tar.bz2 |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Thomas writes:
"A single fix for a missing sanity check when a pinned event is tried
to be read on the wrong CPU due to a legit event scheduling failure."
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/core: Add sanity check to deal with pinned event failure
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/events/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index c80549bf82c6..dcb093e7b377 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3935,6 +3935,12 @@ int perf_event_read_local(struct perf_event *event, u64 *value, goto out; } + /* If this is a pinned event it must be running on this CPU */ + if (event->attr.pinned && event->oncpu != smp_processor_id()) { + ret = -EBUSY; + goto out; + } + /* * If the event is currently on this CPU, its either a per-task event, * or local to this CPU. Furthermore it means its ACTIVE (otherwise |