]> www.infradead.org Git - users/jedix/linux-maple.git/commit
futex: Fix (possible) missed wakeup
authorPeter Zijlstra <peterz@infradead.org>
Thu, 29 Nov 2018 13:44:49 +0000 (14:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2019 16:58:00 +0000 (17:58 +0100)
commitf618b90b11fc45efd13a159f628f27f06ebb8184
treee2abfc3ff4829e62ce9b1c65333d9282021fc6a3
parent635d29f488a9941ca29e02b0bc8aab938cd1d6cc
futex: Fix (possible) missed wakeup

[ Upstream commit b061c38bef43406df8e73c5be06cbfacad5ee6ad ]

We must not rely on wake_q_add() to delay the wakeup; in particular
commit:

  1d0dcb3ad9d3 ("futex: Implement lockless wakeups")

moved wake_q_add() before smp_store_release(&q->lock_ptr, NULL), which
could result in futex_wait() waking before observing ->lock_ptr ==
NULL and going back to sleep again.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 1d0dcb3ad9d3 ("futex: Implement lockless wakeups")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/futex.c