aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/return_address.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-05-25 16:16:40 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-05-25 16:16:40 +0900
commit8a37f520523df971bd3f926d8bd45ead37e857e8 (patch)
tree762b79bb60c55ef320ec72fdf7c079fa14cb765b /arch/sh/kernel/return_address.c
parentfbdev: fix erroneous index in drivers/video/sh_mobile_lcdcfb.c (diff)
downloadlinux-dev-8a37f520523df971bd3f926d8bd45ead37e857e8.tar.xz
linux-dev-8a37f520523df971bd3f926d8bd45ead37e857e8.zip
sh: handle early calls to return_address() when using dwarf unwinder.
The dwarf unwinder ties in to an early initcall, but it's possible that return_address() calls will be made prior to that. This implements some additional error handling in to the dwarf unwinder as well as an exit path in the return_address() case to bail out if the unwinder hasn't come up yet. This fixes a NULL pointer deref in early boot when mempool_alloc() blows up on the not-yet-ready mempool via dwarf_unwind_stack(). Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/return_address.c')
-rw-r--r--arch/sh/kernel/return_address.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/sh/kernel/return_address.c b/arch/sh/kernel/return_address.c
index cbf1dd5372b2..5124aeb28c3f 100644
--- a/arch/sh/kernel/return_address.c
+++ b/arch/sh/kernel/return_address.c
@@ -24,6 +24,8 @@ void *return_address(unsigned int depth)
struct dwarf_frame *tmp;
tmp = dwarf_unwind_stack(ra, frame);
+ if (!tmp)
+ return NULL;
if (frame)
dwarf_free_frame(frame);