Merge "locking/osq_lock: Fix osq_lock queue corruption"

This commit is contained in:
Linux Build Service Account 2017-10-10 23:22:10 -07:00 committed by Gerrit - the friendly Code Review server
commit 34f1071c18

View file

@ -106,6 +106,19 @@ bool osq_lock(struct optimistic_spin_queue *lock)
prev = decode_cpu(old);
node->prev = prev;
/*
* osq_lock() unqueue
*
* node->prev = prev osq_wait_next()
* WMB MB
* prev->next = node next->prev = prev // unqueue-C
*
* Here 'node->prev' and 'next->prev' are the same variable and we need
* to ensure these stores happen in-order to avoid corrupting the list.
*/
smp_wmb();
WRITE_ONCE(prev->next, node);
/*