Using a lock inside a slab of memory to lock against moving the same memory

is definitely a bug.  This fixes it, but the intention of the previous code
might not be what I thought it was.  I won't be sad if this fix is reverted
and something else takes its place.

svn path=/trunk/; revision=39873
This commit is contained in:
Art Yerkes 2009-03-04 17:03:06 +00:00
parent 34e0264ab9
commit ab0b3f0bd4

View file

@ -29,6 +29,7 @@ extern BOOLEAN PnpSystemInit;
/* DATA **********************************************************************/
PDRIVER_OBJECT IopRootDriverObject;
FAST_MUTEX IopBusTypeGuidListLock;
PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList = NULL;
#if defined (ALLOC_PRAGMA)
@ -279,7 +280,7 @@ IopGetBusTypeGuidIndex(LPGUID BusTypeGuid)
PVOID NewList;
/* Acquire the lock */
ExAcquireFastMutex(&IopBusTypeGuidList->Lock);
ExAcquireFastMutex(&IopBusTypeGuidListLock);
/* Loop all entries */
while (i < IopBusTypeGuidList->GuidCount)
@ -333,7 +334,7 @@ IopGetBusTypeGuidIndex(LPGUID BusTypeGuid)
IopBusTypeGuidList->GuidCount++;
Quickie:
ExReleaseFastMutex(&IopBusTypeGuidList->Lock);
ExReleaseFastMutex(&IopBusTypeGuidListLock);
return FoundIndex;
}
@ -2843,6 +2844,7 @@ PnpInit(VOID)
DPRINT("PnpInit()\n");
KeInitializeSpinLock(&IopDeviceTreeLock);
ExInitializeFastMutex(&IopBusTypeGuidListLock);
/* Initialize the Bus Type GUID List */
IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));