diff options
author | tanimura <tanimura@FreeBSD.org> | 2001-04-25 10:22:35 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2001-04-25 10:22:35 +0000 |
commit | ed98caf17b1fb46331b6ceb5ead82dc24c6fe0ba (patch) | |
tree | c49f6d8693a996e9043e3082f2a923b1f666ecbe /sys/kern | |
parent | f863141979de490194a5cb124d97ed1e3a000632 (diff) | |
download | FreeBSD-src-ed98caf17b1fb46331b6ceb5ead82dc24c6fe0ba.zip FreeBSD-src-ed98caf17b1fb46331b6ceb5ead82dc24c6fe0ba.tar.gz |
Do not leave a process with no credential in zombproc.
Reviewed by: jhb
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_exit.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 209210d..ece138d 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -523,6 +523,20 @@ loop: vrele(p->p_textvp); /* + * Finally finished with old proc entry. + * Unlink it from its process group and free it. + */ + leavepgrp(p); + + sx_xlock(&allproc_lock); + LIST_REMOVE(p, p_list); /* off zombproc */ + sx_xunlock(&allproc_lock); + + sx_xlock(&proctree_lock); + LIST_REMOVE(p, p_sibling); + sx_xunlock(&proctree_lock); + + /* * Free up credentials. */ PROC_LOCK(p); @@ -538,30 +552,13 @@ loop: */ if (p->p_args && --p->p_args->ar_ref == 0) FREE(p->p_args, M_PARGS); - PROC_UNLOCK(p); - /* - * Finally finished with old proc entry. - * Unlink it from its process group and free it. - */ - leavepgrp(p); - - sx_xlock(&allproc_lock); - LIST_REMOVE(p, p_list); /* off zombproc */ - sx_xunlock(&allproc_lock); - - sx_xlock(&proctree_lock); - LIST_REMOVE(p, p_sibling); - sx_xunlock(&proctree_lock); - - PROC_LOCK(p); if (--p->p_procsig->ps_refcnt == 0) { if (p->p_sigacts != &p->p_addr->u_sigacts) FREE(p->p_sigacts, M_SUBPROC); FREE(p->p_procsig, M_SUBPROC); p->p_procsig = NULL; } - PROC_UNLOCK(p); /* * Give machine-dependent layer a chance |