Skip to content

Commit

Permalink
[PATCH] Fix memory ordering problem in wake_futex()
Browse files Browse the repository at this point in the history
Fix a memory ordering problem that occurs on IA64. The "store" to q->lock_ptr
in wake_futex() can become visible before wake_up_all() clears the lock in the
futex_q.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Dec 24, 2005
1 parent 6003a93 commit 8e31108
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,13 @@ static void wake_futex(struct futex_q *q)
/*
* The waiting task can free the futex_q as soon as this is written,
* without taking any locks. This must come last.
*
* A memory barrier is required here to prevent the following store
* to lock_ptr from getting ahead of the wakeup. Clearing the lock
* at the end of wake_up_all() does not prevent this store from
* moving.
*/
wmb();
q->lock_ptr = NULL;
}

Expand Down

0 comments on commit 8e31108

Please sign in to comment.