svn commit: r305180 - stable/11/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Sep 1 07:08:02 UTC 2016


Author: kib
Date: Thu Sep  1 07:08:01 2016
New Revision: 305180
URL: https://svnweb.freebsd.org/changeset/base/305180

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

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

Modified: stable/11/sys/kern/kern_umtx.c
==============================================================================
--- stable/11/sys/kern/kern_umtx.c	Thu Sep  1 07:04:47 2016	(r305179)
+++ stable/11/sys/kern/kern_umtx.c	Thu Sep  1 07:08:01 2016	(r305180)
@@ -2743,9 +2743,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) {
@@ -2756,6 +2759,8 @@ sleep:
 					break;
 				state = oldstate;
 				error = umtxq_check_susp(td);
+				if (error != 0)
+					break;
 			}
 		}
 


More information about the svn-src-all mailing list