Skip to content

Commit af17b3a

Browse files
committed
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
2 parents 82ec752 + befb1b3 commit af17b3a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/events/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,6 +3935,12 @@ int perf_event_read_local(struct perf_event *event, u64 *value,
39353935
goto out;
39363936
}
39373937

3938+
/* If this is a pinned event it must be running on this CPU */
3939+
if (event->attr.pinned && event->oncpu != smp_processor_id()) {
3940+
ret = -EBUSY;
3941+
goto out;
3942+
}
3943+
39383944
/*
39393945
* If the event is currently on this CPU, its either a per-task event,
39403946
* or local to this CPU. Furthermore it means its ACTIVE (otherwise

0 commit comments

Comments
 (0)