From 8e31108b9f41069d55cb9b019ac8262c55fd2616 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 23 Dec 2005 19:54:46 -0800 Subject: [PATCH] [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 Acked-by: Ingo Molnar Signed-off-by: Linus Torvalds --- kernel/futex.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index 5872e3507f3..5e71a6bf6f6 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; } -- 2.11.4.GIT