Date: Fri, 19 Apr 2019 12:31:17 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r346372 - stable/11/lib/libthr/thread Message-ID: <201904191231.x3JCVHHo070664@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Apr 19 12:31:16 2019 New Revision: 346372 URL: https://svnweb.freebsd.org/changeset/base/346372 Log: MFC r346158: Do not access mutex memory after unlock. PR: 237195 Modified: stable/11/lib/libthr/thread/thr_mutex.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libthr/thread/thr_mutex.c ============================================================================== --- stable/11/lib/libthr/thread/thr_mutex.c Fri Apr 19 12:30:15 2019 (r346371) +++ stable/11/lib/libthr/thread/thr_mutex.c Fri Apr 19 12:31:16 2019 (r346372) @@ -945,7 +945,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, { struct pthread *curthread; uint32_t id; - int deferred, error, robust; + int deferred, error, private, robust; if (__predict_false(m <= THR_MUTEX_DESTROYED)) { if (m == THR_MUTEX_DESTROYED) @@ -963,6 +963,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, return (EPERM); error = 0; + private = (m->m_flags & PMUTEX_FLAG_PRIVATE) != 0; if (__predict_false(PMUTEX_TYPE(m->m_flags) == PTHREAD_MUTEX_RECURSIVE && m->m_count > 0)) { m->m_count--; @@ -987,7 +988,7 @@ mutex_unlock_common(struct pthread_mutex *m, bool cv, if (robust) _mutex_leave_robust(curthread, m); } - if (!cv && m->m_flags & PMUTEX_FLAG_PRIVATE) + if (!cv && private) THR_CRITICAL_LEAVE(curthread); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904191231.x3JCVHHo070664>