svn commit: r313472 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Feb 9 13:32:21 UTC 2017


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))


More information about the svn-src-all mailing list