summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-12-28 06:15:08 +0000
committerdg <dg@FreeBSD.org>1994-12-28 06:15:08 +0000
commit6e06858bb0353d6897789359b0edf03edc653763 (patch)
tree575b6a81598477ef24bc59908c38f71b3148dee1 /sys/kern/kern_exit.c
parent2b3d7b4180f8e8ab17aa54212791a39d4708b93b (diff)
downloadFreeBSD-src-6e06858bb0353d6897789359b0edf03edc653763.zip
FreeBSD-src-6e06858bb0353d6897789359b0edf03edc653763.tar.gz
Fixed multiple bugs that cause null pointers to be followed or FREEed data
to be accessed if a process blocks when it is being run down.
Diffstat (limited to 'sys/kern/kern_exit.c')
-rw-r--r--sys/kern/kern_exit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 61eb984..e3cee98 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
- * $Id: kern_exit.c,v 1.11 1994/10/11 20:42:01 sos Exp $
+ * $Id: kern_exit.c,v 1.12 1994/10/27 05:21:39 phk Exp $
*/
#include <sys/param.h>
@@ -264,8 +264,10 @@ done:
* Other substructures are freed from wait().
*/
curproc = NULL;
- if (--p->p_limit->p_refcnt == 0)
+ if (--p->p_limit->p_refcnt == 0) {
FREE(p->p_limit, M_SUBPROC);
+ p->p_limit = NULL;
+ }
/*
* Finally, call machine-dependent code to release the remaining
@@ -404,6 +406,7 @@ loop:
p->p_xstat = 0;
ruadd(&q->p_stats->p_cru, p->p_ru);
FREE(p->p_ru, M_ZOMBIE);
+ p->p_ru = NULL;
/*
* Decrement the count of procs running with this uid.
@@ -416,6 +419,7 @@ loop:
if (--p->p_cred->p_refcnt == 0) {
crfree(p->p_cred->pc_ucred);
FREE(p->p_cred, M_SUBPROC);
+ p->p_cred = NULL;
}
/*
OpenPOWER on IntegriCloud