summaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-04-04 11:08:40 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-17 08:38:53 +0200
commitf7b778b9007e2f1e5e8992489567904f9258f389 (patch)
tree9283f8a0ad56be89f60df7ea45622ead2ded12b9 /arch/xtensa
parentcb75a0c5d3816531af8b768975f25e320e988f62 (diff)
downloadlinux-stable-f7b778b9007e2f1e5e8992489567904f9258f389.tar.gz
linux-stable-f7b778b9007e2f1e5e8992489567904f9258f389.tar.bz2
linux-stable-f7b778b9007e2f1e5e8992489567904f9258f389.zip
xtensa: fix return_address
commit ada770b1e74a77fff2d5f539bf6c42c25f4784db upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/kernel/stacktrace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/xtensa/kernel/stacktrace.c b/arch/xtensa/kernel/stacktrace.c
index 0df4080fa20f..a94da7dd3eae 100644
--- a/arch/xtensa/kernel/stacktrace.c
+++ b/arch/xtensa/kernel/stacktrace.c
@@ -253,10 +253,14 @@ static int return_address_cb(struct stackframe *frame, void *data)
return 1;
}
+/*
+ * level == 0 is for the return address from the caller of this function,
+ * not from this function itself.
+ */
unsigned long return_address(unsigned level)
{
struct return_addr_data r = {
- .skip = level + 1,
+ .skip = level,
};
walk_stackframe(stack_pointer(NULL), return_address_cb, &r);
return r.addr;