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

commit 543d3902599e98401dae73ca690f89b93b6d8d7d
Author:     Thomas Faber <[email protected]>
AuthorDate: Sat Jan 14 16:36:57 2023 -0500
Commit:     Thomas Faber <[email protected]>
CommitDate: Sat Jan 14 17:52:17 2023 -0500

    [NTOS:IO] Handle missing device instance in IopInitializeBuiltinDriver. 
CORE-18793
---
 ntoskrnl/io/iomgr/driver.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c
index 61ac27ed25b..498b09ea40f 100644
--- a/ntoskrnl/io/iomgr/driver.c
+++ b/ntoskrnl/io/iomgr/driver.c
@@ -967,9 +967,16 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY 
BootLdrEntry)
                 instancePath.Buffer[instancePath.Length / sizeof(WCHAR)] = 
UNICODE_NULL;
 
                 PDEVICE_OBJECT pdo = 
IopGetDeviceObjectFromDeviceInstance(&instancePath);
-                PiQueueDeviceAction(pdo, PiActionAddBootDevices, NULL, NULL);
-                ObDereferenceObject(pdo);
-                deviceAdded = TRUE;
+                if (pdo != NULL)
+                {
+                    PiQueueDeviceAction(pdo, PiActionAddBootDevices, NULL, 
NULL);
+                    ObDereferenceObject(pdo);
+                    deviceAdded = TRUE;
+                }
+                else
+                {
+                    DPRINT1("No device node found matching instance path 
'%wZ'\n", &instancePath);
+                }
             }
 
             ExFreePool(kvInfo);

Reply via email to