diff options
author | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-06 00:23:38 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@rei2.9hal> | 2012-02-06 00:23:38 +0100 |
commit | 9d60d8262e4ab285da2903192a341ceb81a05eb5 (patch) | |
tree | df28cd2901a167b091663b13f331386c65e9bc25 | |
parent | 3599f733ee9828b80a6f470646463793e01838e3 (diff) |
fix potential double ready in postnote() for rendezvous
-rw-r--r-- | sys/src/9/port/proc.c | 8 | ||||
-rw-r--r-- | sys/src/9/port/sysproc.c | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c index c101b9988..37cdbf18d 100644 --- a/sys/src/9/port/proc.c +++ b/sys/src/9/port/proc.c @@ -95,7 +95,7 @@ schedinit(void) /* never returns */ procalloc.free = up; /* proc is free now, make sure unlock() wont touch it */ - up = procalloc.p = nil; + up = procalloc.Lock.p = nil; unlock(&procalloc); sched(); } @@ -418,7 +418,7 @@ ready(Proc *p) print("double ready %s %lud pc %p\n", p->text, p->pid, getcallerpc(&p)); return; } - + s = splhi(); if(edfready(p)){ splx(s); @@ -984,16 +984,16 @@ postnote(Proc *p, int dolock, char *n, int flag) if(p->state == Rendezvous) { Proc *d, **l; - p->rendval = ~0; l = &REND(p->rgrp, p->rendtag); for(d = *l; d; d = d->rendhash) { if(d == p) { *l = p->rendhash; + p->rendval = ~0; + ready(p); break; } l = &d->rendhash; } - ready(p); } unlock(p->rgrp); break; diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c index f539cf930..93785ceb8 100644 --- a/sys/src/9/port/sysproc.c +++ b/sys/src/9/port/sysproc.c @@ -811,7 +811,6 @@ sysrendezvous(ulong *arg) tag = arg[0]; l = &REND(up->rgrp, tag); - up->rendval = ~(uintptr)0; lock(up->rgrp); for(p = *l; p; p = p->rendhash) { @@ -819,11 +818,10 @@ sysrendezvous(ulong *arg) *l = p->rendhash; val = p->rendval; p->rendval = arg[1]; - + unlock(up->rgrp); while(p->mach != 0) ; ready(p); - unlock(up->rgrp); return val; } l = &p->rendhash; |