From e2bbb41a308267c5bcc2c6a8c5224b1638a2904f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 22 Jan 2012 22:33:15 +0100 Subject: fix unlock(&procalloc) race on mp systems --- sys/src/9/port/proc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c index 118561f3a..669c4652f 100644 --- a/sys/src/9/port/proc.c +++ b/sys/src/9/port/proc.c @@ -86,13 +86,15 @@ schedinit(void) /* never returns */ * 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); -- cgit v1.2.3