aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2003-03-12 11:10:04 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2003-03-12 11:10:04 +0000
commit3890793e9c2c5d52c50d4a9b0b0f6d1e1485b231 (patch)
treeb40e54119ce451252623b117d2f6a1e45c3cad27
parent9eb8572ea2aeba149c1519a362171eaa4ada22db (diff)
downloadsrc-3890793e9c2c5d52c50d4a9b0b0f6d1e1485b231.tar.gz
src-3890793e9c2c5d52c50d4a9b0b0f6d1e1485b231.zip
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().
Notes
Notes: svn path=/head/; revision=112139
-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 6cc3e0ae7258..f0554e0c296f 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);
/*