s390: add error handling to perf_callchain_kernel

perf_callchain_kernel stops neither when it encounters a garbage
address, nor when it runs out of space. Fix both issues using x86
version as an inspiration.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Ilya Leoshkevich 2019-10-30 14:20:32 +01:00 committed by Vasily Gorbik
parent 265f79dcb5
commit effb83ccc8

View File

@ -224,9 +224,13 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
struct pt_regs *regs)
{
struct unwind_state state;
unsigned long addr;
unwind_for_each_frame(&state, current, regs, 0)
perf_callchain_store(entry, state.ip);
unwind_for_each_frame(&state, current, regs, 0) {
addr = unwind_get_return_address(&state);
if (!addr || perf_callchain_store(entry, addr))
return;
}
}
/* Perf definitions for PMU event attributes in sysfs */