Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2019 19:18:25 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350005 - head/sys/kern
Message-ID:  <201907151918.x6FJIPFo077975@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jul 15 19:18:25 2019
New Revision: 350005
URL: https://svnweb.freebsd.org/changeset/base/350005

Log:
  In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry.
  
  Reported by:	ler
  Bisected and reviewed by:	markj
  Sponsored by:	The FreeBSD Foundation
  MFC after:	12 days

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c	Mon Jul 15 17:13:32 2019	(r350004)
+++ head/sys/kern/kern_umtx.c	Mon Jul 15 19:18:25 2019	(r350005)
@@ -3316,14 +3316,13 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st
 
 	uq = td->td_umtxq;
 	flags = fuword32(&sem->_flags);
-	error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
-	if (error != 0)
-		return (error);
-
 	if (timeout != NULL)
 		abs_timeout_init2(&timo, timeout);
 
 again:
+	error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
+	if (error != 0)
+		return (error);
 	umtxq_lock(&uq->uq_key);
 	umtxq_busy(&uq->uq_key);
 	umtxq_insert(uq);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907151918.x6FJIPFo077975>