git: 9front

Download patch

ref: c8ed006d49973bb15377d5cf4ae01898b46a72cc
parent: cebcef9cd131672f088744e19af3eb33197f9e30
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Sun Jan 22 17:33:15 EST 2012

fix unlock(&procalloc) race on mp systems

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -86,13 +86,15 @@
 			 *	palloc
 			 */
 			mmurelease(up);
+			unlock(&palloc);
 
 			up->qnext = procalloc.free;
 			procalloc.free = up;
 
-			unlock(&palloc);
+			/* proc is free now, make sure unlock() wont touch it */
+			up = procalloc.p = nil;
 			unlock(&procalloc);
-			break;
+			sched();
 		}
 		up->mach = nil;
 		updatecpu(up);
--