Skip to content

Commit

Permalink
mn10300: prevent double syscall restarts
Browse files Browse the repository at this point in the history
set ->orig_d0 to -1, same as what sigreturn does

Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Al Viro authored and torvalds committed Sep 27, 2010
1 parent e46924d commit 00cbf60
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions arch/mn10300/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
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
*/
Expand Down Expand Up @@ -459,7 +465,7 @@ static int handle_signal(int sig,
/* fallthrough */
case -ERESTARTNOINTR:
regs->d0 = regs->orig_d0;
regs->pc -= 2;
stepback(regs);
}
}

Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 00cbf60

Please sign in to comment.