Commit b460b51
powerpc/perf: Fix crashes with generic_compat_pmu & BHRB
The bhrb_filter_map ("The Branch History Rolling Buffer") callback is
only defined in raw CPUs' power_pmu structs. The "architected" CPUs
use generic_compat_pmu, which does not have this callback, and crashes
occur if a user tries to enable branch stack for an event.
This add a NULL pointer check for bhrb_filter_map() which behaves as
if the callback returned an error.
This does not add the same check for config_bhrb() as the only caller
checks for cpuhw->bhrb_users which remains zero if bhrb_filter_map==0.
Fixes: be80e75 ("powerpc/perf: Add generic compat mode pmu driver")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200602025612.62707-1-aik@ozlabs.ru1 parent b91eb51 commit b460b51
1 file changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1557 | 1557 | | |
1558 | 1558 | | |
1559 | 1559 | | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
1563 | 1570 | | |
1564 | 1571 | | |
1565 | 1572 | | |
| |||
1881 | 1888 | | |
1882 | 1889 | | |
1883 | 1890 | | |
1884 | | - | |
1885 | 1891 | | |
1886 | 1892 | | |
1887 | 1893 | | |
| |||
1987 | 1993 | | |
1988 | 1994 | | |
1989 | 1995 | | |
1990 | | - | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
1991 | 2000 | | |
1992 | 2001 | | |
1993 | 2002 | | |
| |||
0 commit comments