rwlock: fix r313454

The runlock slow path would update wrong variable before restarting the
loop, in effect corrupting the state.

Reported by:	pho
This commit is contained in:
Mateusz Guzik 2017-02-09 13:32:19 +00:00
parent 3b3cf014fc
commit 8eaaf58a5f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=313472

View File

@ -755,7 +755,7 @@ __rw_runlock_hard(volatile uintptr_t *c, struct thread *td, uintptr_t v,
if (!atomic_cmpset_rel_ptr(&rw->rw_lock, RW_READERS_LOCK(1) | v,
x)) {
turnstile_chain_unlock(&rw->lock_object);
x = RW_READ_VALUE(rw);
v = RW_READ_VALUE(rw);
continue;
}
if (LOCK_LOG_TEST(&rw->lock_object, 0))