svn commit: r305184 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Sep 1 07:20:52 UTC 2016


Author: kib
Date: Thu Sep  1 07:20:50 2016
New Revision: 305184
URL: https://svnweb.freebsd.org/changeset/base/305184

Log:
  MFC r304808:
  Prevent leak of URWLOCK_READ_WAITERS flag for urwlocks.
  
  PR:	211947

Modified:
  stable/10/sys/kern/kern_umtx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_umtx.c
==============================================================================
--- stable/10/sys/kern/kern_umtx.c	Thu Sep  1 07:19:04 2016	(r305183)
+++ stable/10/sys/kern/kern_umtx.c	Thu Sep  1 07:20:50 2016	(r305184)
@@ -2965,9 +2965,12 @@ sleep:
 		suword32(&rwlock->rw_blocked_readers, blocked_readers-1);
 		if (blocked_readers == 1) {
 			rv = fueword32(&rwlock->rw_state, &state);
-			if (rv == -1)
+			if (rv == -1) {
+				umtxq_unbusy_unlocked(&uq->uq_key);
 				error = EFAULT;
-			while (error == 0) {
+				break;
+			}
+			for (;;) {
 				rv = casueword32(&rwlock->rw_state, state,
 				    &oldstate, state & ~URWLOCK_READ_WAITERS);
 				if (rv == -1) {
@@ -2978,6 +2981,8 @@ sleep:
 					break;
 				state = oldstate;
 				error = umtxq_check_susp(td);
+				if (error != 0)
+					break;
 			}
 		}
 


More information about the svn-src-all mailing list