aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_rwlock.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2017-02-09 13:32:19 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2017-02-09 13:32:19 +0000
commit8eaaf58a5f62fc8fcce50c619d34b58e6957e67c (patch)
tree381934479df07c4a76c6f9f632d807ef880039bc /sys/kern/kern_rwlock.c
parent3b3cf014fc98c3e3193ae117c22b60526545275d (diff)
downloadsrc-8eaaf58a5f62fc8fcce50c619d34b58e6957e67c.tar.gz
src-8eaaf58a5f62fc8fcce50c619d34b58e6957e67c.zip
rwlock: fix r313454
The runlock slow path would update wrong variable before restarting the loop, in effect corrupting the state. Reported by: pho
Notes
Notes: svn path=/head/; revision=313472
Diffstat (limited to 'sys/kern/kern_rwlock.c')
-rw-r--r--sys/kern/kern_rwlock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index be1c42e8ee0a..9464588b9eda 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -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))