diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-21 19:36:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-08-21 19:36:32 -0400 |
commit | 7d06bafc4a49214068893acd8bfd2660554538ca (patch) | |
tree | 6d81f9d6a33e8e837cddf0ce3b7bf53627d639c5 /arch | |
parent | 69bbe136a911bd5d45d0e633daaeb9d1239bf54f (diff) | |
parent | ee7538a008a45050c8f706d38b600f55953169f9 (diff) |
Merge tag 'arm64-stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64
Pull arm64 perf fixes from Catalin Marinas:
"Perf backend fixes for arm64 where the user can cause kernel panic
(discovered with Vince's fuzzing tool)"
* tag 'arm64-stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
arm64: perf: fix event validation for software group leaders
arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm64/kernel/perf_event.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 9ba33c40cdf8..12e6ccb88691 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c | |||
@@ -107,7 +107,12 @@ armpmu_map_cache_event(const unsigned (*cache_map) | |||
107 | static int | 107 | static int |
108 | armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config) | 108 | armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config) |
109 | { | 109 | { |
110 | int mapping = (*event_map)[config]; | 110 | int mapping; |
111 | |||
112 | if (config >= PERF_COUNT_HW_MAX) | ||
113 | return -EINVAL; | ||
114 | |||
115 | mapping = (*event_map)[config]; | ||
111 | return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping; | 116 | return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping; |
112 | } | 117 | } |
113 | 118 | ||
@@ -317,6 +322,9 @@ validate_event(struct pmu_hw_events *hw_events, | |||
317 | struct hw_perf_event fake_event = event->hw; | 322 | struct hw_perf_event fake_event = event->hw; |
318 | struct pmu *leader_pmu = event->group_leader->pmu; | 323 | struct pmu *leader_pmu = event->group_leader->pmu; |
319 | 324 | ||
325 | if (is_software_event(event)) | ||
326 | return 1; | ||
327 | |||
320 | if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) | 328 | if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) |
321 | return 1; | 329 | return 1; |
322 | 330 | ||