[NTOS:IO]

- Do not crash if an invalid PDO is given to IopEditDeviceList
- Always dereference device object when removing it (should be the last reference)
CORE-8294

svn path=/trunk/; revision=63917
This commit is contained in:
Hervé Poussineau 2014-08-22 19:14:31 +00:00
parent b36bcbb154
commit e3ab3c712a
2 changed files with 6 additions and 1 deletions

View file

@ -351,6 +351,11 @@ IopEditDeviceList(IN PDRIVER_OBJECT DriverObject,
while (Previous->NextDevice != DeviceObject)
{
/* Not this one, keep moving */
if (!Previous->NextDevice)
{
DPRINT1("Failed to remove PDO %p on driver %wZ (not found)\n", DeviceObject, &DeviceObject->DriverObject->DriverName);
return;
}
Previous = Previous->NextDevice;
}

View file

@ -597,6 +597,7 @@ IopSendRemoveDevice(IN PDEVICE_OBJECT DeviceObject)
&GUID_TARGET_DEVICE_REMOVE_COMPLETE,
NULL,
NULL);
ObDereferenceObject(DeviceObject);
}
static
@ -4431,7 +4432,6 @@ IopSendRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations)
for (i = 0; i < DeviceRelations->Count; i++)
{
IopSendRemoveDevice(DeviceRelations->Objects[i]);
ObDereferenceObject(DeviceRelations->Objects[i]);
DeviceRelations->Objects[i] = NULL;
}