Author: attilio
Date: Mon Jun 28 17:45:00 2010
New Revision: 209577
URL: http://svn.freebsd.org/changeset/base/209577

Log:
  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

Modified:
  head/sys/kern/kern_clock.c

Modified: head/sys/kern/kern_clock.c
==============================================================================
--- head/sys/kern/kern_clock.c  Mon Jun 28 17:06:19 2010        (r209576)
+++ head/sys/kern/kern_clock.c  Mon Jun 28 17:45:00 2010        (r209577)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to