https://git.reactos.org/?p=reactos.git;a=commitdiff;h=05590079cca5e176c2ab6c6e211f83c75b67b74c

commit 05590079cca5e176c2ab6c6e211f83c75b67b74c
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Sun Sep 5 02:44:20 2021 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Sep 12 18:19:59 2021 +0200

    [NTOS:KD64] First unlock the KD port then lower the IRQL, instead of doing 
the reverse. (#3942)
    
    This properly reverses the operation of first raising the IRQL before
    locking the KD port.
---
 ntoskrnl/kd64/kdapi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ntoskrnl/kd64/kdapi.c b/ntoskrnl/kd64/kdapi.c
index 28438a699a2..7b2419f4e34 100644
--- a/ntoskrnl/kd64/kdapi.c
+++ b/ntoskrnl/kd64/kdapi.c
@@ -1987,8 +1987,8 @@ KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
         if (NeedLock)
         {
             /* Do the unlock */
-            KeLowerIrql(OldIrql);
             KdpPortUnlock();
+            KeLowerIrql(OldIrql);
 
             /* Fail: We're already enabled */
             return STATUS_INVALID_PARAMETER;
@@ -2022,8 +2022,8 @@ KdEnableDebuggerWithLock(IN BOOLEAN NeedLock)
     if (NeedLock)
     {
         /* Yes, now unlock it */
-        KeLowerIrql(OldIrql);
         KdpPortUnlock();
+        KeLowerIrql(OldIrql);
     }
 
     /* We're done */
@@ -2083,8 +2083,8 @@ KdDisableDebuggerWithLock(IN BOOLEAN NeedLock)
             if (!NT_SUCCESS(Status))
             {
                 /* Release the lock and fail */
-                KeLowerIrql(OldIrql);
                 KdpPortUnlock();
+                KeLowerIrql(OldIrql);
                 return Status;
             }
         }
@@ -2112,8 +2112,8 @@ KdDisableDebuggerWithLock(IN BOOLEAN NeedLock)
     if (NeedLock)
     {
         /* Yes, now unlock it */
-        KeLowerIrql(OldIrql);
         KdpPortUnlock();
+        KeLowerIrql(OldIrql);
     }
 
     /* We're done */

Reply via email to