mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 17:51:57 +09:00
arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
commit868f6fea8fupstream. This is a port ofd9f966357b("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. Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
805eea0bb1
commit
975a3cd4cc
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user