Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 May 2012 15:58:27 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235787 - head/sys/kern
Message-ID:  <201205221558.q4MFwRh6011477@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue May 22 15:58:27 2012
New Revision: 235787
URL: http://svn.freebsd.org/changeset/base/235787

Log:
  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>

Modified:
  head/sys/kern/kern_fork.c
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_fork.c
==============================================================================
--- head/sys/kern/kern_fork.c	Tue May 22 15:26:55 2012	(r235786)
+++ head/sys/kern/kern_fork.c	Tue May 22 15:58:27 2012	(r235787)
@@ -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);

Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c	Tue May 22 15:26:55 2012	(r235786)
+++ head/sys/kern/kern_racct.c	Tue May 22 15:58:27 2012	(r235787)
@@ -573,6 +573,9 @@ out:
 	PROC_UNLOCK(child);
 	PROC_UNLOCK(parent);
 
+	if (error != 0)
+		racct_proc_exit(child);
+
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205221558.q4MFwRh6011477>