Author: mjg
Date: Thu Feb  9 13:32:19 2017
New Revision: 313472
URL: https://svnweb.freebsd.org/changeset/base/313472

Log:
  rwlock: fix r313454
  
  The runlock slow path would update wrong variable before restarting the
  loop, in effect corrupting the state.
  
  Reported by:  pho

Modified:
  head/sys/kern/kern_rwlock.c

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Thu Feb  9 09:02:45 2017        (r313471)
+++ head/sys/kern/kern_rwlock.c Thu Feb  9 13:32:19 2017        (r313472)
@@ -755,7 +755,7 @@ __rw_runlock_hard(volatile uintptr_t *c,
                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))
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to