mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTOS:MM] Acquire PsLoadedModuleResource when walking PsLoadedModuleList. CORE-16449
This commit is contained in:
parent
a30edc324e
commit
ba9bf73d48
2 changed files with 7 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue