From 0972f71d9abb1a7e88660cbfbe8e2d564bb1e102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Bi=C8=99oc?= Date: Fri, 16 Jun 2023 00:13:30 +0200 Subject: [PATCH] [NTOS:PNP] Assert the presence of a device extension when handling PnP root power IRPs Handling PnP root driver power IRPs requires that a device object must come up with a device extension to determine whether it is a function driver and if so, handle the IRP accordingly. CORE-18989 --- ntoskrnl/io/pnpmgr/pnproot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c index c41844b64d3..58d740b7d3b 100644 --- a/ntoskrnl/io/pnpmgr/pnproot.c +++ b/ntoskrnl/io/pnpmgr/pnproot.c @@ -1473,6 +1473,12 @@ PnpRootPowerControl( Status = Irp->IoStatus.Status; IrpSp = IoGetCurrentIrpStackLocation(Irp); + /* + * We must handle power IRPs based on whether it is a function driver + * or not from the device extension, so it cannot be NULL. + */ + ASSERT(DeviceExtension); + if (DeviceExtension->Common.IsFDO) { ASSERT(!DeviceExtension->Common.IsFDO);