]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.35/xtensa-fix-return_address.patch
Linux 4.19.35
[thirdparty/kernel/stable-queue.git] / releases / 4.19.35 / xtensa-fix-return_address.patch
CommitLineData
d33cec38
GKH
1From ada770b1e74a77fff2d5f539bf6c42c25f4784db Mon Sep 17 00:00:00 2001
2From: Max Filippov <jcmvbkbc@gmail.com>
3Date: Thu, 4 Apr 2019 11:08:40 -0700
4Subject: xtensa: fix return_address
5
6From: Max Filippov <jcmvbkbc@gmail.com>
7
8commit ada770b1e74a77fff2d5f539bf6c42c25f4784db upstream.
9
10return_address returns the address that is one level higher in the call
11stack than requested in its argument, because level 0 corresponds to its
12caller's return address. Use requested level as the number of stack
13frames to skip.
14
15This fixes the address reported by might_sleep and friends.
16
17Cc: stable@vger.kernel.org
18Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
19Signed-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;