[ros-diffs] [arty] 39873: 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.

arty at svn.reactos.org arty at svn.reactos.org
Wed Mar 4 18:03:07 CET 2009


Author: arty
Date: Wed Mar  4 20:03:06 2009
New Revision: 39873

URL: http://svn.reactos.org/svn/reactos?rev=39873&view=rev
Log:
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.

Modified:
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c?rev=39873&r1=39872&r2=39873&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Wed Mar  4 20:03:06 2009
@@ -29,6 +29,7 @@
 /* DATA **********************************************************************/
 
 PDRIVER_OBJECT IopRootDriverObject;
+FAST_MUTEX IopBusTypeGuidListLock;
 PIO_BUS_TYPE_GUID_LIST IopBusTypeGuidList = NULL;
 
 #if defined (ALLOC_PRAGMA)
@@ -279,7 +280,7 @@
    PVOID NewList;
 
    /* Acquire the lock */
-   ExAcquireFastMutex(&IopBusTypeGuidList->Lock);
+   ExAcquireFastMutex(&IopBusTypeGuidListLock);
 
    /* Loop all entries */
    while (i < IopBusTypeGuidList->GuidCount)
@@ -333,7 +334,7 @@
    IopBusTypeGuidList->GuidCount++;
 
 Quickie:
-   ExReleaseFastMutex(&IopBusTypeGuidList->Lock);
+   ExReleaseFastMutex(&IopBusTypeGuidListLock);
    return FoundIndex;
 }
 
@@ -2843,7 +2844,8 @@
     DPRINT("PnpInit()\n");
 
     KeInitializeSpinLock(&IopDeviceTreeLock);
-
+	ExInitializeFastMutex(&IopBusTypeGuidListLock);
+	
     /* Initialize the Bus Type GUID List */
     IopBusTypeGuidList = ExAllocatePool(PagedPool, sizeof(IO_BUS_TYPE_GUID_LIST));
     if (!IopBusTypeGuidList) {



More information about the Ros-diffs mailing list