From 4fcdd410b356850a77a61a5c1bc8d117f4277f44 Mon Sep 17 00:00:00 2001 From: attilio Date: Thu, 13 Sep 2007 09:12:36 +0000 Subject: subr_sleepqueue.c presents a thread lock missing which leads to dangerous races for some struct thread members. More specifically, this bug seems responsible for some memory dumping problems people were experiencing. Fix this adding correct thread locking. Tested by: rwatson Submitted by: tegge Approved by: jeff Approved by: re --- sys/kern/subr_sleepqueue.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sys/kern/subr_sleepqueue.c') diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 911761d..d0856f9 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -328,6 +328,7 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags, MPASS((flags & SLEEPQ_TYPE) == sq->sq_type); LIST_INSERT_HEAD(&sq->sq_free, td->td_sleepqueue, sq_hash); } + thread_lock(td); TAILQ_INSERT_TAIL(&sq->sq_blocked[queue], td, td_slpq); td->td_sleepqueue = NULL; td->td_sqqueue = queue; @@ -337,6 +338,7 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags, td->td_flags |= TDF_SINTR; td->td_flags &= ~TDF_SLEEPABORT; } + thread_unlock(td); } /* -- cgit v1.1