Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 141bf9e5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "locking/osq_lock: Fix osq_lock queue corruption"

parents 3d28f0cc 32cce10a
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -102,6 +102,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();

	ACCESS_ONCE(prev->next) = node;

	/*