[Midnightbsd-cvs] src: thr_mutex.c: Fix a null pointer dereference in the POSIX priority

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Oct 7 12:29:17 EDT 2007


Log Message:
-----------
Fix a null pointer dereference in the POSIX priority classes.

Modified Files:
--------------
    src/lib/libthr/thread:
        thr_mutex.c (r1.1.1.2 -> r1.2)

-------------- next part --------------
Index: thr_mutex.c
===================================================================
RCS file: /home/cvs/src/lib/libthr/thread/thr_mutex.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -Llib/libthr/thread/thr_mutex.c -Llib/libthr/thread/thr_mutex.c -u -r1.1.1.2 -r1.2
--- lib/libthr/thread/thr_mutex.c
+++ lib/libthr/thread/thr_mutex.c
@@ -628,11 +628,14 @@
 
 				/* Unlock the mutex structure: */
 				THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
-				clock_gettime(CLOCK_REALTIME, &ts);
-				TIMESPEC_SUB(&ts2, abstime, &ts);
-				ret = _thr_umtx_wait(&curthread->cycle, cycle,
-					 &ts2);
+				if (abstime != NULL) {
+					clock_gettime(CLOCK_REALTIME, &ts);
+					TIMESPEC_SUB(&ts2, abstime, &ts);
+					ret = _thr_umtx_wait(&curthread->cycle,
+						cycle, &ts2);
+				} else
+					ret = _thr_umtx_wait(&curthread->cycle,
+						cycle, NULL);
 				if (ret == EINTR)
 					ret = 0;
 
@@ -711,11 +714,14 @@
 
 				/* Unlock the mutex structure: */
 				THR_LOCK_RELEASE(curthread, &(*m)->m_lock);
-
-				clock_gettime(CLOCK_REALTIME, &ts);
-				TIMESPEC_SUB(&ts2, abstime, &ts);
-				ret = _thr_umtx_wait(&curthread->cycle, cycle,
-					&ts2);
+				if (abstime != NULL) {
+					clock_gettime(CLOCK_REALTIME, &ts);
+					TIMESPEC_SUB(&ts2, abstime, &ts);
+					ret = _thr_umtx_wait(&curthread->cycle,
+						cycle, &ts2);
+				} else
+					ret = _thr_umtx_wait(&curthread->cycle,
+						cycle, NULL);
 				if (ret == EINTR)
 					ret = 0;
 


More information about the Midnightbsd-cvs mailing list