summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-13 14:56:56 +0000
committerguenther <guenther@openbsd.org>2014-07-13 14:56:56 +0000
commit492fea0e9ba38d1c790c8adbf62fdeb356dae1ae (patch)
tree3d512a8af459ac0d0dcdda5cd95c6a79e642432b
parentWhen renewing a lease, update client->active or you end up in a (diff)
downloadwireguard-openbsd-492fea0e9ba38d1c790c8adbf62fdeb356dae1ae.tar.xz
wireguard-openbsd-492fea0e9ba38d1c790c8adbf62fdeb356dae1ae.zip
If the only process in the pgrp is in the middle of exiting, it might
not have any threads left. Treat that the same as an empty pgrp. encountered by and ok deraadt@
-rw-r--r--sys/kern/tty.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 2fb04ad11aa..41b42bab418 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.111 2014/07/12 18:43:32 tedu Exp $ */
+/* $OpenBSD: tty.c,v 1.112 2014/07/13 14:56:56 guenther Exp $ */
/* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */
/*-
@@ -2149,7 +2149,7 @@ ttyinfo(struct tty *tp)
else if (tp->t_pgrp == NULL)
ttyprintf(tp, "no foreground process group\n");
else if ((pr = LIST_FIRST(&tp->t_pgrp->pg_members)) == NULL)
- ttyprintf(tp, "empty foreground process group\n");
+empty: ttyprintf(tp, "empty foreground process group\n");
else {
const char *state;
fixpt_t pctcpu, pctcpu2;
@@ -2219,6 +2219,8 @@ update_pickpr:
* Otherwise take the newest thread
*/
pick = p = TAILQ_FIRST(&pickpr->ps_threads);
+ if (p == NULL)
+ goto empty;
run = p->p_stat == SRUN || p->p_stat == SONPROC;
pctcpu = p->p_pctcpu;
while ((p = TAILQ_NEXT(p, p_thr_link)) != NULL) {