diff options
author | attilio <attilio@FreeBSD.org> | 2007-09-13 09:12:36 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2007-09-13 09:12:36 +0000 |
commit | 4fcdd410b356850a77a61a5c1bc8d117f4277f44 (patch) | |
tree | 066a1c8cc8781a22a505854795195b4bb6a11e13 /sys | |
parent | c3b29b612d8405bcfbb6f23c9e9bbde3179d3bf2 (diff) | |
download | FreeBSD-src-4fcdd410b356850a77a61a5c1bc8d117f4277f44.zip FreeBSD-src-4fcdd410b356850a77a61a5c1bc8d117f4277f44.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_sleepqueue.c | 2 |
1 files changed, 2 insertions, 0 deletions
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); } /* |