https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0c8f07854b88c594674644ecbe30cf94c66d4d54

commit 0c8f07854b88c594674644ecbe30cf94c66d4d54
Author:     Stanislav Motylkov <[email protected]>
AuthorDate: Fri May 7 21:54:10 2021 +0300
Commit:     Stanislav Motylkov <[email protected]>
CommitDate: Fri May 7 21:54:10 2021 +0300

    [NTOS:PS] Fix misplaced Thread variable reference caught by RTC
    
    Addendum to 2e88e2b9.
---
 ntoskrnl/ps/query.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/ntoskrnl/ps/query.c b/ntoskrnl/ps/query.c
index b25e6928422..968b24623ef 100644
--- a/ntoskrnl/ps/query.c
+++ b/ntoskrnl/ps/query.c
@@ -2454,14 +2454,6 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
             }
             _SEH2_END;
 
-            /* This is only valid for the current thread */
-            if (Thread != PsGetCurrentThread())
-            {
-                /* Fail */
-                Status = STATUS_INVALID_PARAMETER;
-                break;
-            }
-
             /* Reference the thread */
             Status = ObReferenceObjectByHandle(ThreadHandle,
                                                THREAD_SET_INFORMATION,
@@ -2472,6 +2464,14 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
             if (!NT_SUCCESS(Status))
                 break;
 
+            /* This is only valid for the current thread */
+            if (Thread != PsGetCurrentThread())
+            {
+                /* Fail */
+                Status = STATUS_INVALID_PARAMETER;
+                break;
+            }
+
             /* Get the process */
             Process = Thread->ThreadsProcess;
 

Reply via email to