Skip to content

Commit beecfd6

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: stacktrace: Check kretprobe_find_ret_addr() return value
If kretprobe_find_ret_addr() fails to find the original return address, it returns 0. Check for this case so that a reliable stacktrace won't silently ignore it. Signed-off-by: Mark Rutland <[email protected]> Cc: Andrea della Porta <[email protected]> Cc: Breno Leitao <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Miroslav Benes <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Song Liu <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-and-tested-by: Song Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 91b89a6 commit beecfd6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/arm64/kernel/stacktrace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ kunwind_recover_return_address(struct kunwind_state *state)
152152
orig_pc = kretprobe_find_ret_addr(state->task,
153153
(void *)state->common.fp,
154154
&state->kr_cur);
155+
if (!orig_pc)
156+
return -EINVAL;
155157
state->common.pc = orig_pc;
156158
state->flags.kretprobe = 1;
157159
}

0 commit comments

Comments
 (0)