svn commit: r297853 - head/lib/libthr/thread

Konstantin Belousov kib at FreeBSD.org
Tue Apr 12 10:25:46 UTC 2016


Author: kib
Date: Tue Apr 12 10:25:44 2016
New Revision: 297853
URL: https://svnweb.freebsd.org/changeset/base/297853

Log:
  If off-page lookup failed, there is no memory to perform
  shared_mutex_init() upon.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/lib/libthr/thread/thr_mutex.c

Modified: head/lib/libthr/thread/thr_mutex.c
==============================================================================
--- head/lib/libthr/thread/thr_mutex.c	Tue Apr 12 07:54:55 2016	(r297852)
+++ head/lib/libthr/thread/thr_mutex.c	Tue Apr 12 10:25:44 2016	(r297853)
@@ -476,7 +476,8 @@ check_and_init_mutex(pthread_mutex_t *mu
 		*m = __thr_pshared_offpage(mutex, 0);
 		if (*m == NULL)
 			ret = EINVAL;
-		shared_mutex_init(*m, NULL);
+		else
+			shared_mutex_init(*m, NULL);
 	} else if (__predict_false(*m <= THR_MUTEX_DESTROYED)) {
 		if (*m == THR_MUTEX_DESTROYED) {
 			ret = EINVAL;


More information about the svn-src-head mailing list