summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-06-28 17:45:00 +0000
committerattilio <attilio@FreeBSD.org>2010-06-28 17:45:00 +0000
commitf818dc9368ead3a52cc53e5347ac177c6c082775 (patch)
tree07503708ef1c39557f4e2dbf87e10abe1d24fb30 /sys/kern/kern_clock.c
parent27450f928887021c02a2b656ffc2d6ae0c43737b (diff)
downloadFreeBSD-src-f818dc9368ead3a52cc53e5347ac177c6c082775.zip
FreeBSD-src-f818dc9368ead3a52cc53e5347ac177c6c082775.tar.gz
Fix a lock leak in the deadlock resolver in case the ticks counter
wrapped up. Sponsored by: Sandvine Incorporated Submitted by: pluknet <pluknet at gmail dot com> Reported by: Anton Yuzhaninov <citrin at citrin dot ru> Reviewed by: jhb MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r--sys/kern/kern_clock.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index fdc5905..5097862 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -213,8 +213,10 @@ deadlkres(void)
MPASS(td->td_blocked != NULL);
/* Handle ticks wrap-up. */
- if (ticks < td->td_blktick)
+ if (ticks < td->td_blktick) {
+ thread_unlock(td);
continue;
+ }
tticks = ticks - td->td_blktick;
thread_unlock(td);
if (tticks > blkticks) {
@@ -233,8 +235,10 @@ deadlkres(void)
} else if (TD_IS_SLEEPING(td)) {
/* Handle ticks wrap-up. */
- if (ticks < td->td_blktick)
+ if (ticks < td->td_blktick) {
+ thread_unlock(td);
continue;
+ }
/*
* Check if the thread is sleeping on a
OpenPOWER on IntegriCloud