ARM: 7809/1: perf: fix event validation for software group leaders
authorWill Deacon <will.deacon@arm.com>
Wed, 7 Aug 2013 22:39:41 +0000 (23:39 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 10 Sep 2013 00:57:23 +0000 (01:57 +0100)
commit5fff965ef7b5b2a3715b1a4005e6515716e49305
tree67045c9097fee68a83e268f398f6382f6a38bc19
parentc372ce3c31bf53445e71426b56252ca8238c330f
ARM: 7809/1: perf: fix event validation for software group leaders

commit c95eb3184ea1a3a2551df57190c81da695e2144b upstream.

It is possible to construct an event group with a software event as a
group leader and then subsequently add a hardware event to the group.
This results in the event group being validated by adding all members
of the group to a fake PMU and attempting to allocate each event on
their respective PMU.

Unfortunately, for software events wthout a corresponding arm_pmu, this
results in a kernel crash attempting to dereference the ->get_event_idx
function pointer.

This patch fixes the problem by checking explicitly for software events
and ignoring those in event validation (since they can always be
scheduled). We will probably want to revisit this for 3.12, since the
validation checks don't appear to work correctly when dealing with
multiple hardware PMUs anyway.

Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Vince Weaver <vincent.weaver@maine.edu>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm/kernel/perf_event.c