mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 16:31:07 +08:00
[NTOS:MM] Acquire PsLoadedModuleResource when walking PsLoadedModuleList. CORE-16449
This commit is contained in:
@@ -1466,13 +1466,14 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||
/* Assume failure */
|
||||
*StartVa = NULL;
|
||||
|
||||
/* Acquire the necessary lock while we loop the list */
|
||||
/* Acquire the necessary locks while we loop the list */
|
||||
KeEnterCriticalRegion();
|
||||
KeWaitForSingleObject(&MmSystemLoadLock,
|
||||
WrVirtualMemory,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
ExAcquireResourceExclusiveLite(&PsLoadedModuleResource, TRUE);
|
||||
|
||||
/* Loop all loaded modules */
|
||||
NextEntry = PsLoadedModuleList.Flink;
|
||||
@@ -1620,7 +1621,8 @@ MiFindInitializationCode(OUT PVOID *StartVa,
|
||||
NextEntry = NextEntry->Flink;
|
||||
}
|
||||
|
||||
/* Release the lock and return */
|
||||
/* Release the locks and return */
|
||||
ExReleaseResourceLite(&PsLoadedModuleResource);
|
||||
KeReleaseMutant(&MmSystemLoadLock, 1, FALSE, FALSE);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
||||
@@ -273,7 +273,8 @@ MmInitSystem(IN ULONG Phase,
|
||||
/* Initialize the balance set manager */
|
||||
MmInitBsmThread();
|
||||
|
||||
/* Loop the boot loaded images */
|
||||
/* Loop the boot loaded images (under lock) */
|
||||
ExAcquireResourceExclusiveLite(&PsLoadedModuleResource, TRUE);
|
||||
for (ListEntry = PsLoadedModuleList.Flink;
|
||||
ListEntry != &PsLoadedModuleList;
|
||||
ListEntry = ListEntry->Flink)
|
||||
@@ -284,6 +285,7 @@ MmInitSystem(IN ULONG Phase,
|
||||
/* Set up the image protection */
|
||||
MiWriteProtectSystemImage(DataTableEntry->DllBase);
|
||||
}
|
||||
ExReleaseResourceLite(&PsLoadedModuleResource);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user