[NTOS:EX]
authorThomas Faber <thomas.faber@reactos.org>
Sat, 1 Oct 2016 09:03:47 +0000 (09:03 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 1 Oct 2016 09:03:47 +0000 (09:03 +0000)
- Acquire ProcessLock before accessing a process's thread list in NtQuerySystemInformation/SystemProcessInformation. Patch by Volodymyr Shcherbyna.
CORE-12001 #resolve

svn path=/trunk/; revision=72873

reactos/ntoskrnl/ex/sysinfo.c

index e95c29a..b9fed78 100644 (file)
@@ -812,6 +812,10 @@ QSI_DEF(SystemProcessInformation)
         {
             SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
 
+            /* Lock the Process */
+            KeEnterCriticalRegion();
+            ExAcquirePushLockShared(&Process->ProcessLock);
+
             if ((Process->ProcessExiting) &&
                 (Process->Pcb.Header.SignalState) &&
                 !(Process->ActiveThreads) &&
@@ -821,6 +825,10 @@ QSI_DEF(SystemProcessInformation)
                         Process, Process->ImageFileName, Process->UniqueProcessId);
                 CurrentSize = 0;
                 ImageNameMaximumLength = 0;
+
+                /* Unlock the Process */
+                ExReleasePushLockShared(&Process->ProcessLock);
+                KeLeaveCriticalRegion();
                 goto Skip;
             }
 
@@ -955,6 +963,10 @@ QSI_DEF(SystemProcessInformation)
                 ProcessImageName = NULL;
             }
 
+            /* Unlock the Process */
+            ExReleasePushLockShared(&Process->ProcessLock);
+            KeLeaveCriticalRegion();
+
             /* Handle idle process entry */
 Skip:
             if (Process == PsIdleProcess) Process = NULL;