From e47240fb371b65ff76d3e1176110d288da8bf944 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Tue, 5 Mar 2019 22:27:15 +0100 Subject: [PATCH] [USBPORT] Release StateChangeSpinLock before acquiring MiniportSpinLock. Found by Driver Verifier. --- drivers/usb/usbport/endpoint.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index 385206a0c83..c1624ec297f 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -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); }