diff options
author | Andrew Morton <akpm@osdl.org> | 2005-12-24 04:54:46 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-24 21:13:27 +0100 |
commit | 8e31108b9f41069d55cb9b019ac8262c55fd2616 (patch) | |
tree | 4d3b74956402b978417ee1026fa18409773cd72e /kernel/futex.c | |
parent | [PATCH] add missing memory barriers to ipc/sem.c (diff) | |
download | linux-8e31108b9f41069d55cb9b019ac8262c55fd2616.tar.xz linux-8e31108b9f41069d55cb9b019ac8262c55fd2616.zip |
[PATCH] Fix memory ordering problem in wake_futex()
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>
Diffstat (limited to '')
-rw-r--r-- | kernel/futex.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 5872e3507f35..5e71a6bf6f6b 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -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; } |