https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e47240fb371b65ff76d3e…
commit e47240fb371b65ff76d3e1176110d288da8bf944
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Tue Mar 5 22:27:15 2019 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Mon Mar 11 08:53:50 2019 +0100
[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 385206a0c8..c1624ec297 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);
}