mn10300: prevent double syscall restarts
authorAl Viro <viro@ftp.linux.org.uk>
Sun, 26 Sep 2010 18:28:42 +0000 (19:28 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 27 Sep 2010 19:19:53 +0000 (12:19 -0700)
set ->orig_d0 to -1, same as what sigreturn does

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/mn10300/kernel/signal.c

index 57178a8d5af0d475837737420f31aa1a8772b9d5..4ef99256fa498b9dd38f3f828ff82b68c06d544c 100644 (file)
@@ -432,6 +432,12 @@ give_sigsegv:
        return -EFAULT;
 }
 
+static inline void stepback(struct pt_regs *regs)
+{
+       regs->pc -= 2;
+       regs->orig_d0 = -1;
+}
+
 /*
  * handle the actual delivery of a signal to userspace
  */
@@ -459,7 +465,7 @@ static int handle_signal(int sig,
                        /* fallthrough */
                case -ERESTARTNOINTR:
                        regs->d0 = regs->orig_d0;
-                       regs->pc -= 2;
+                       stepback(regs);
                }
        }
 
@@ -527,12 +533,12 @@ static void do_signal(struct pt_regs *regs)
                case -ERESTARTSYS:
                case -ERESTARTNOINTR:
                        regs->d0 = regs->orig_d0;
-                       regs->pc -= 2;
+                       stepback(regs);
                        break;
 
                case -ERESTART_RESTARTBLOCK:
                        regs->d0 = __NR_restart_syscall;
-                       regs->pc -= 2;
+                       stepback(regs);
                        break;
                }
        }