Fix a recursion on the thread lock by acquiring it after call rtp_to_pri().

Reported by:	swills
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D23495
This commit is contained in:
Jeff Roberson 2020-02-04 02:42:54 +00:00
parent dc3915c8c6
commit c8ea36e881
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357486

View File

@ -271,14 +271,12 @@ thread_create(struct thread *td, struct rtprio *rtp,
tidhash_add(newtd);
/* ignore timesharing class */
if (rtp != NULL && !(td->td_pri_class == PRI_TIMESHARE &&
rtp->type == RTP_PRIO_NORMAL))
rtp_to_pri(rtp, newtd);
thread_lock(newtd);
if (rtp != NULL) {
if (!(td->td_pri_class == PRI_TIMESHARE &&
rtp->type == RTP_PRIO_NORMAL)) {
rtp_to_pri(rtp, newtd);
sched_prio(newtd, newtd->td_user_pri);
} /* ignore timesharing class */
}
TD_SET_CAN_RUN(newtd);
sched_add(newtd, SRQ_BORING);