nios2: fix syscall restart checks
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 8 Aug 2022 15:08:48 +0000 (16:08 +0100)
committerDinh Nguyen <dinguyen@kernel.org>
Mon, 15 Aug 2022 16:25:32 +0000 (11:25 -0500)
sys_foo() returns -512 (aka -ERESTARTSYS) => do_signal() sees
512 in r2 and 1 in r1.

sys_foo() returns 512 => do_signal() sees 512 in r2 and 0 in r1.

The former is restart-worthy; the latter obviously isn't.

Fixes: b53e906d255d ("nios2: Signal handling support")
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
arch/nios2/kernel/signal.c

index cb0b915..15e672d 100644 (file)
@@ -242,7 +242,7 @@ static int do_signal(struct pt_regs *regs)
        /*
         * If we were from a system call, check for system call restarting...
         */
-       if (regs->orig_r2 >= 0) {
+       if (regs->orig_r2 >= 0 && regs->r1) {
                continue_addr = regs->ea;
                restart_addr = continue_addr - 4;
                retval = regs->r2;