summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-03-12 11:10:04 +0000
committertjr <tjr@FreeBSD.org>2003-03-12 11:10:04 +0000
commit59d57301951fc16795ae0ccc7ca7e0244a3bf040 (patch)
treeb40e54119ce451252623b117d2f6a1e45c3cad27 /sys/kern/kern_exit.c
parentb8198d98a4863b23975e3a6f8549ce3cffa877f5 (diff)
downloadFreeBSD-src-59d57301951fc16795ae0ccc7ca7e0244a3bf040.zip
FreeBSD-src-59d57301951fc16795ae0ccc7ca7e0244a3bf040.tar.gz
In wait1(), remove the zombie process from zombproc before removing
it from its pgrp to avoid leaving zombies around with p_pgrp == NULL. This bug was apparent as a NULL-dereference in the pid selection code in fork1().
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 6cc3e0a..f0554e0 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -657,17 +657,17 @@ loop:
mtx_unlock(&Giant);
return (0);
}
- /*
- * Remove other references to this process to ensure
- * we have an exclusive reference.
- */
- leavepgrp(p);
sx_xlock(&allproc_lock);
LIST_REMOVE(p, p_list); /* off zombproc */
sx_xunlock(&allproc_lock);
LIST_REMOVE(p, p_sibling);
+ /*
+ * Remove other references to this process to ensure
+ * we have an exclusive reference.
+ */
+ leavepgrp(p);
sx_xunlock(&proctree_lock);
/*
OpenPOWER on IntegriCloud