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>
This commit is contained in:
Edward Tomasz Napierala 2012-05-22 15:58:27 +00:00
parent e27f871969
commit ab27d5d88a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=235787
2 changed files with 4 additions and 1 deletions

View File

@ -939,8 +939,8 @@ fork1(struct thread *td, int flags, int pages, struct proc **procp,
#ifdef MAC
mac_proc_destroy(newproc);
#endif
fail1:
racct_proc_exit(newproc);
fail1:
if (vm2 != NULL)
vmspace_free(vm2);
uma_zfree(proc_zone, newproc);

View File

@ -573,6 +573,9 @@ racct_proc_fork(struct proc *parent, struct proc *child)
PROC_UNLOCK(child);
PROC_UNLOCK(parent);
if (error != 0)
racct_proc_exit(child);
return (error);
}