s390/unwind: fix get_stack_pointer(NULL, NULL)
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 2 Oct 2019 10:56:27 +0000 (12:56 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 31 Oct 2019 16:20:53 +0000 (17:20 +0100)
unwind_for_each_frame(NULL, NULL, 0) does not return any valid frames.

The reason is that get_stack_pointer, unlike get_stack_info and
show_stack, does not handle NULL argument.

Fix by making get_stack_pointer treat NULL as current, like
get_stack_info and show_stack do.

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Tested-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/include/asm/stacktrace.h

index 0ae4bbf..fee4021 100644 (file)
@@ -38,7 +38,7 @@ static inline unsigned long get_stack_pointer(struct task_struct *task,
 {
        if (regs)
                return (unsigned long) kernel_stack_pointer(regs);
-       if (task == current)
+       if (!task || task == current)
                return current_stack_pointer();
        return (unsigned long) task->thread.ksp;
 }