When walking user stack frames the first stack frame (where the stack
pointer points to) should be skipped: the return address of the current
function is saved in the previous stack frame, not the current stack frame,
which is allocated for to be called functions.
Fixes: aa44433ac4ee ("s390: add USER_STACKTRACE support")
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
        while (1) {
                if (__get_user(sp, &sf->back_chain))
                        break;
+               /* Sanity check: ABI requires SP to be 8 byte aligned. */
+               if (!sp || sp & 0x7)
+                       break;
+               sf = (void __user *)sp;
                if (__get_user(ip, &sf->gprs[8]))
                        break;
                if (ip & 0x1) {
                }
                if (!store_ip(consume_entry, cookie, entry, perf, ip))
                        return;
-               /* Sanity check: ABI requires SP to be aligned 8 bytes. */
-               if (!sp || sp & 0x7)
-                       break;
-               sf = (void __user *)sp;
                first = false;
        }
        pagefault_enable();