arm64: perf: fix event validation for software group leaders
authorWill Deacon <will.deacon@arm.com>
Tue, 20 Aug 2013 10:47:40 +0000 (11:47 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 20 Aug 2013 11:05:57 +0000 (12:05 +0100)
This is a port of c95eb3184ea1 ("ARM: 7809/1: perf: fix event validation
for software group leaders") to arm64, which fixes a panic 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>
arch/arm64/kernel/perf_event.c

index 2012646fb46f7d82a414d014f7e1f9c0b45f32e7..12e6ccb88691c65e6a20d761275babb1af369182 100644 (file)
@@ -322,6 +322,9 @@ validate_event(struct pmu_hw_events *hw_events,
        struct hw_perf_event fake_event = event->hw;
        struct pmu *leader_pmu = event->group_leader->pmu;
 
+       if (is_software_event(event))
+               return 1;
+
        if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF)
                return 1;