[USBPORT] Release StateChangeSpinLock before acquiring MiniportSpinLock.
authorThomas Faber <thomas.faber@reactos.org>
Tue, 5 Mar 2019 21:27:15 +0000 (22:27 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 11 Mar 2019 07:53:50 +0000 (08:53 +0100)
Found by Driver Verifier.

drivers/usb/usbport/endpoint.c

index 385206a..c1624ec 100644 (file)
@@ -1252,6 +1252,7 @@ USBPORT_ReopenPipe(IN PDEVICE_OBJECT FdoDevice,
 
         if (Endpoint->StateLast == USBPORT_ENDPOINT_ACTIVE)
         {
+            KeReleaseSpinLockFromDpcLevel(&Endpoint->StateChangeSpinLock);
             KeAcquireSpinLockAtDpcLevel(&FdoExtension->MiniportSpinLock);
 
             Packet->SetEndpointState(FdoExtension->MiniPortExt,
@@ -1260,8 +1261,11 @@ USBPORT_ReopenPipe(IN PDEVICE_OBJECT FdoDevice,
 
             KeReleaseSpinLockFromDpcLevel(&FdoExtension->MiniportSpinLock);
         }
+        else
+        {
+            KeReleaseSpinLockFromDpcLevel(&Endpoint->StateChangeSpinLock);
+        }
 
-        KeReleaseSpinLockFromDpcLevel(&Endpoint->StateChangeSpinLock);
         KeReleaseSpinLock(&Endpoint->EndpointSpinLock, Endpoint->EndpointOldIrql);
     }