]>
Commit | Line | Data |
---|---|---|
d33cec38 GKH |
1 | From ada770b1e74a77fff2d5f539bf6c42c25f4784db Mon Sep 17 00:00:00 2001 |
2 | From: Max Filippov <jcmvbkbc@gmail.com> | |
3 | Date: Thu, 4 Apr 2019 11:08:40 -0700 | |
4 | Subject: xtensa: fix return_address | |
5 | ||
6 | From: Max Filippov <jcmvbkbc@gmail.com> | |
7 | ||
8 | commit ada770b1e74a77fff2d5f539bf6c42c25f4784db upstream. | |
9 | ||
10 | return_address returns the address that is one level higher in the call | |
11 | stack than requested in its argument, because level 0 corresponds to its | |
12 | caller's return address. Use requested level as the number of stack | |
13 | frames to skip. | |
14 | ||
15 | This fixes the address reported by might_sleep and friends. | |
16 | ||
17 | Cc: stable@vger.kernel.org | |
18 | Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | arch/xtensa/kernel/stacktrace.c | 6 +++++- | |
23 | 1 file changed, 5 insertions(+), 1 deletion(-) | |
24 | ||
25 | --- a/arch/xtensa/kernel/stacktrace.c | |
26 | +++ b/arch/xtensa/kernel/stacktrace.c | |
27 | @@ -253,10 +253,14 @@ static int return_address_cb(struct stac | |
28 | return 1; | |
29 | } | |
30 | ||
31 | +/* | |
32 | + * level == 0 is for the return address from the caller of this function, | |
33 | + * not from this function itself. | |
34 | + */ | |
35 | unsigned long return_address(unsigned level) | |
36 | { | |
37 | struct return_addr_data r = { | |
38 | - .skip = level + 1, | |
39 | + .skip = level, | |
40 | }; | |
41 | walk_stackframe(stack_pointer(NULL), return_address_cb, &r); | |
42 | return r.addr; |