diff options
Diffstat (limited to 'kern/gsync.c')
-rw-r--r-- | kern/gsync.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/gsync.c b/kern/gsync.c index 68b3d0b0..d0f609fb 100644 --- a/kern/gsync.c +++ b/kern/gsync.c @@ -191,14 +191,14 @@ kern_return_t gsync_wait (task_t task, vm_offset_t addr, if (unlikely (bucket < 0)) return (KERN_INVALID_ADDRESS); - struct gsync_hbucket *hbp = gsync_buckets + bucket; - simple_lock (&hbp->lock); - - /* Now test that the address is actually valid for the + /* Test that the address is actually valid for the * given task. Do so with the read-lock held in order * to prevent memory deallocations. */ vm_map_lock_read (task->map); + struct gsync_hbucket *hbp = gsync_buckets + bucket; + simple_lock (&hbp->lock); + if (unlikely (!valid_access_p (task->map, addr, flags))) { simple_unlock (&hbp->lock); @@ -285,9 +285,9 @@ kern_return_t gsync_wake (task_t task, kern_return_t ret = KERN_INVALID_ARGUMENT; + vm_map_lock_read (task->map); struct gsync_hbucket *hbp = gsync_buckets + bucket; simple_lock (&hbp->lock); - vm_map_lock_read (task->map); if (unlikely (!valid_access_p (task->map, addr, flags))) { |