- Don't call RtlEqualUnicodeString (paged code) while holding a spin lock. Powered by Driver Verifier.

svn path=/trunk/; revision=64762
This commit is contained in:
Thomas Faber 2014-10-16 16:40:13 +00:00
parent c38e07c128
commit 32f8a44f8e

View file

@ -99,6 +99,22 @@ NpInitializeWaitQueue(IN PNP_WAIT_QUEUE WaitQueue)
KeInitializeSpinLock(&WaitQueue->WaitLock);
}
static
BOOLEAN
NpEqualUnicodeString(IN PCUNICODE_STRING String1,
IN PCUNICODE_STRING String2)
{
SIZE_T EqualLength;
if (String1->Length != String2->Length)
return FALSE;
EqualLength = RtlCompareMemory(String1->Buffer,
String2->Buffer,
String1->Length);
return EqualLength == String1->Length;
}
NTSTATUS
NTAPI
NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue,
@ -156,7 +172,8 @@ NpCancelWaiter(IN PNP_WAIT_QUEUE WaitQueue,
PipeName.MaximumLength = PipeName.Length;
}
if (RtlEqualUnicodeString(&WaitName, &PipeName, FALSE))
/* Can't use RtlEqualUnicodeString with a spinlock held */
if (NpEqualUnicodeString(&WaitName, &PipeName))
{
/* Found a matching wait. Cancel it */
RemoveEntryList(&WaitIrp->Tail.Overlay.ListEntry);