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

commit a74ff5be178fd252d743d41558130ffefecf8321
Author:     Thomas Faber <[email protected]>
AuthorDate: Thu Oct 28 11:17:03 2021 -0400
Commit:     Thomas Faber <[email protected]>
CommitDate: Sat Nov 13 21:23:39 2021 -0500

    [NTOS:IO] Don't call IopCompleteRequest with uninitialized context values. 
CID 716761
    
    NormalContext and NormalRoutine are just for good measure, but
    SystemArgument2 is actually used by the function.
    And yes, this appears to be a bug in Win 2003.
---
 ntoskrnl/io/iomgr/iofunc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c
index eeb6040cf30..784a836a15d 100644
--- a/ntoskrnl/io/iomgr/iofunc.c
+++ b/ntoskrnl/io/iomgr/iofunc.c
@@ -148,6 +148,8 @@ IopPerformSynchronousRequest(IN PDEVICE_OBJECT DeviceObject,
         if (Status != STATUS_PENDING)
         {
             /* Complete it ourselves */
+            NormalRoutine = NULL;
+            NormalContext = NULL;
             ASSERT(!Irp->PendingReturned);
             KeRaiseIrql(APC_LEVEL, &OldIrql);
             IopCompleteRequest(&Irp->Tail.Apc,
@@ -2640,6 +2642,8 @@ NtQueryInformationFile(IN HANDLE FileHandle,
         Irp->UserIosb = IoStatusBlock;
 
         /* The IRP wasn't completed, complete it ourselves */
+        NormalRoutine = NULL;
+        NormalContext = NULL;
         KeRaiseIrql(APC_LEVEL, &OldIrql);
         IopCompleteRequest(&Irp->Tail.Apc,
                            &NormalRoutine,
@@ -3480,6 +3484,8 @@ NtSetInformationFile(IN HANDLE FileHandle,
         Irp->UserIosb = IoStatusBlock;
 
         /* The IRP wasn't completed, complete it ourselves */
+        NormalRoutine = NULL;
+        NormalContext = NULL;
         KeRaiseIrql(APC_LEVEL, &OldIrql);
         IopCompleteRequest(&Irp->Tail.Apc,
                            &NormalRoutine,

Reply via email to