Skip to content

Commit

Permalink
arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
Browse files Browse the repository at this point in the history
This is a port of d9f9663 ("ARM: 7810/1: perf: Fix array out of
bounds access in armpmu_map_hw_event()") to arm64, which fixes an oops
in the arm64 perf backend found as a result of Vince's fuzzing tool.

Cc: <stable@vger.kernel.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
  • Loading branch information
Will Deacon authored and Catalin Marinas committed Aug 20, 2013
1 parent c095ba7 commit 868f6fe
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/arm64/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)
static int
armpmu_map_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
{
int mapping = (*event_map)[config];
int mapping;

if (config >= PERF_COUNT_HW_MAX)
return -EINVAL;

mapping = (*event_map)[config];
return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
}

Expand Down

0 comments on commit 868f6fe

Please sign in to comment.