Author: mmacy Date: Thu May 17 19:41:58 2018 New Revision: 333758 URL: https://svnweb.freebsd.org/changeset/base/333758
Log: epoch(9): fix potential deadlock Don't acquire a waiting thread's lock while holding our own Approved by: sbruno Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Thu May 17 19:30:57 2018 (r333757) +++ head/sys/kern/subr_epoch.c Thu May 17 19:41:58 2018 (r333758) @@ -407,9 +407,13 @@ epoch_block_handler(struct ck_epoch *global __unused, * restore on exit from epoch_wait(). */ if (!TD_IS_INHIBITED(tdwait) && tdwait->td_priority > td->td_priority) { + critical_enter(); + thread_unlock(td); thread_lock(tdwait); sched_prio(tdwait, td->td_priority); thread_unlock(tdwait); + thread_lock(td); + critical_exit(); } if (TD_IS_INHIBITED(tdwait) && TD_ON_LOCK(tdwait) && ((ts = tdwait->td_blocked) != NULL)) { _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"