diff options
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 5cdaa10728d67..7526638b92116 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -474,6 +474,19 @@ tty_wait_background(struct tty *tp, struct thread *td, int sig) sig = 0; } PGRP_LOCK(pg); + + /* + * pg may no longer be our process group. + * Re-check after locking process group. + */ + PROC_LOCK(p); + if (p->p_pgrp != pg) { + PROC_UNLOCK(p); + PGRP_UNLOCK(pg); + continue; + } + + PROC_UNLOCK(p); pgsignal(pg, ksi.ksi_signo, 1, &ksi); PGRP_UNLOCK(pg); |