diff options
author | trasz <trasz@FreeBSD.org> | 2012-05-22 15:58:27 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2012-05-22 15:58:27 +0000 |
commit | 3a811deac759f68cc1a1d7de0ee8ef5b84169f9f (patch) | |
tree | c53914e53b243e512153a3d9ae159429213c2f38 | |
parent | d1d8560148b9e67eb619ed84268d3fd537ef93e0 (diff) | |
download | FreeBSD-src-3a811deac759f68cc1a1d7de0ee8ef5b84169f9f.zip FreeBSD-src-3a811deac759f68cc1a1d7de0ee8ef5b84169f9f.tar.gz |
Fix panic with RACCT that could occur in low memory (or out of swap)
situations, due to fork1() calling racct_proc_exit() without calling
racct_proc_fork() first.
Submitted by: Mateusz Guzik <mjguzik at gmail dot com> (earlier version)
Reviewed by: Mateusz Guzik <mjguzik at gmail dot com>
-rw-r--r-- | sys/kern/kern_fork.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_racct.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 449d3d3..7a0cece 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -939,8 +939,8 @@ fail: #ifdef MAC mac_proc_destroy(newproc); #endif -fail1: racct_proc_exit(newproc); +fail1: if (vm2 != NULL) vmspace_free(vm2); uma_zfree(proc_zone, newproc); diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 081b312..534780f 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -573,6 +573,9 @@ out: PROC_UNLOCK(child); PROC_UNLOCK(parent); + if (error != 0) + racct_proc_exit(child); + return (error); } |