]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] patch 2.5.50+, ehci-hcd loop termination
authorDavid Brownell <david-b@pacbell.net>
Mon, 9 Dec 2002 02:08:07 +0000 (18:08 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 9 Dec 2002 02:08:07 +0000 (18:08 -0800)
While in search of a different bug, I found this one
that got in with the recent 'async_next' patch.  The
schedule scan termination changed (had to), but it
wasn't quite correct.  Slower and/or misbehaving
devices might have wedged a CPU ... fix is simple,
only restart the scan when the list may have changed.

drivers/usb/host/ehci-q.c

index e07979d5899b51939a23ce9ad35c94ad70507e8c..c4c6b9f7e6c1ddd3293421a86f4b12b77c39b26a 100644 (file)
@@ -978,13 +978,18 @@ rescan:
                do {
                        /* clean any finished work for this qh */
                        if (!list_empty (&qh->qtd_list)) {
-                               // dbg_qh ("scan_async", ehci, qh);
-                               qh = qh_get (qh);
+                               int temp;
 
-                               /* concurrent unlink could happen here */
-                               count += qh_completions (ehci, qh);
+                               /* unlinks could happen here; completion
+                                * reporting drops the lock.
+                                */
+                               qh = qh_get (qh);
+                               temp = qh_completions (ehci, qh);
                                qh_put (ehci, qh);
-                               goto rescan;
+                               if (temp != 0) {
+                                       count += temp;
+                                       goto rescan;
+                               }
                        }
 
                        /* unlink idle entries, reducing HC PCI usage as