shithub: riscv

Download patch

ref: e2bbb41a308267c5bcc2c6a8c5224b1638a2904f
parent: 158a3cf4dda6d7d8bb0a8688d58bf267d75041bb
author: cinap_lenrek <[email protected]>
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);