diff options
author | attilio <attilio@FreeBSD.org> | 2010-06-28 17:45:00 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2010-06-28 17:45:00 +0000 |
commit | f818dc9368ead3a52cc53e5347ac177c6c082775 (patch) | |
tree | 07503708ef1c39557f4e2dbf87e10abe1d24fb30 | |
parent | 27450f928887021c02a2b656ffc2d6ae0c43737b (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/kern/kern_clock.c | 8 |
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 |