https://git.reactos.org/?p=reactos.git;a=commitdiff;h=46fbc6f43231314551c6bc5d680386a5886b318a
commit 46fbc6f43231314551c6bc5d680386a5886b318a Author: Hervé Poussineau <[email protected]> AuthorDate: Sun Oct 17 23:41:27 2021 +0200 Commit: Hervé Poussineau <[email protected]> CommitDate: Mon Oct 18 22:23:49 2021 +0200 [NTOS:PNP] Fix crash when removing a device without resources This fixes commit 89fd2b86e4e1013269961a30c3f1135342df08c9 --- ntoskrnl/io/pnpmgr/devaction.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/io/pnpmgr/devaction.c b/ntoskrnl/io/pnpmgr/devaction.c index e9caa760bb5..2126d31e059 100644 --- a/ntoskrnl/io/pnpmgr/devaction.c +++ b/ntoskrnl/io/pnpmgr/devaction.c @@ -1652,9 +1652,13 @@ IopSendRemoveDevice(IN PDEVICE_OBJECT DeviceObject) PiIrpSendRemoveCheckVpb(DeviceObject, IRP_MN_REMOVE_DEVICE); /* Start of HACK: update resources stored in registry, so IopDetectResourceConflict works */ - DeviceNode->ResourceList->Count = 0; - DeviceNode->ResourceListTranslated->Count = 0; - IopUpdateResourceMapForPnPDevice(DeviceNode); + if (DeviceNode->ResourceList) + { + ASSERT(DeviceNode->ResourceListTranslated); + DeviceNode->ResourceList->Count = 0; + DeviceNode->ResourceListTranslated->Count = 0; + IopUpdateResourceMapForPnPDevice(DeviceNode); + } /* End of HACK */ PiSetDevNodeState(DeviceNode, DeviceNodeRemoved);
