[USBEHCI]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 23 Jan 2012 04:22:11 +0000 (04:22 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 23 Jan 2012 04:22:11 +0000 (04:22 +0000)
- Don't complete irps with lock held

svn path=/branches/usb-bringup-trunk/; revision=55091

drivers/usb/usbehci_new/usb_queue.cpp

index a7936b2..ed605d1 100644 (file)
@@ -695,6 +695,7 @@ CUSBQueue::QueueHeadCleanup(
     IUSBRequest * Request;
     BOOLEAN ShouldReleaseWhenDone;
     USBD_STATUS UrbStatus;
+    KIRQL OldLevel;
 
     //
     // sanity checks
@@ -763,11 +764,21 @@ CUSBQueue::QueueHeadCleanup(
         //
         if (Request->GetQueueHead(&NewQueueHead) == STATUS_SUCCESS)
         {
+            //
+            // first acquire request lock
+            //
+            KeAcquireSpinLock(&m_Lock, &OldLevel);
+
             //
             // add to pending list
             //
             InsertTailList(&m_PendingRequestAsyncList, &NewQueueHead->LinkedQueueHeads);
 
+            //
+            // release queue head
+            //
+            KeReleaseSpinLock(&m_Lock, OldLevel);
+
             //
             // Done for now
             //
@@ -859,10 +870,20 @@ CUSBQueue::CompleteAsyncRequests()
         //
         Request = (IUSBRequest*) CurrentQH->Request;
 
+        //
+        // release lock
+        //
+        KeReleaseSpinLock(&m_Lock, OldLevel);
+
         //
         // complete request now
         //
         QueueHeadCleanup(CurrentQH);
+
+        //
+        // first acquire request lock
+        //
+        KeAcquireSpinLock(&m_Lock, &OldLevel);
     }
 
     //