Skip to content

Commit ada770b

Browse files
committed
xtensa: fix return_address
return_address returns the address that is one level higher in the call stack than requested in its argument, because level 0 corresponds to its caller's return address. Use requested level as the number of stack frames to skip. This fixes the address reported by might_sleep and friends. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
1 parent 2663147 commit ada770b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/xtensa/kernel/stacktrace.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data)
253253
return 1;
254254
}
255255

256+
/*
257+
* level == 0 is for the return address from the caller of this function,
258+
* not from this function itself.
259+
*/
256260
unsigned long return_address(unsigned level)
257261
{
258262
struct return_addr_data r = {
259-
.skip = level + 1,
263+
.skip = level,
260264
};
261265
walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
262266
return r.addr;

0 commit comments

Comments
 (0)