diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2020-10-28 22:12:47 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2020-10-28 22:12:47 +0000 |
commit | 3cbf9dc81c0436b11fca7829c55bcc94fdb4e52c (patch) | |
tree | 4f69a57860aab30fcfe147b5f2747d7a08ae288e | |
parent | 1ef64e3da5fb023436893a635e336e591aba120a (diff) |
Notes
-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); |