https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2b9941e7cbdca2202871f8...
commit 2b9941e7cbdca2202871f8a71c9564f81392a11f Author: Hervé Poussineau hpoussin@reactos.org AuthorDate: Thu Jun 18 18:18:13 2020 +0200 Commit: Hervé Poussineau hpoussin@reactos.org CommitDate: Sat Jun 20 08:16:24 2020 +0200
[PCI] Fix PDO removal
We must not do anything on PDO removal, especially not deleting it. We are allowed to delete it, only once we successfully completed a IRP_MN_QUERY_DEVICE_RELATIONS without with PDO. --- drivers/bus/pci/pdo.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
diff --git a/drivers/bus/pci/pdo.c b/drivers/bus/pci/pdo.c index 1d6b8c54ecf..139aed69439 100644 --- a/drivers/bus/pci/pdo.c +++ b/drivers/bus/pci/pdo.c @@ -1577,34 +1577,11 @@ PdoPnpControl( case IRP_MN_STOP_DEVICE: case IRP_MN_QUERY_REMOVE_DEVICE: case IRP_MN_CANCEL_REMOVE_DEVICE: + case IRP_MN_REMOVE_DEVICE: case IRP_MN_SURPRISE_REMOVAL: Status = STATUS_SUCCESS; break;
- case IRP_MN_REMOVE_DEVICE: - { - PPDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - PFDO_DEVICE_EXTENSION FdoDeviceExtension = DeviceExtension->Fdo->DeviceExtension; - KIRQL OldIrql; - - /* Remove it from the device list */ - KeAcquireSpinLock(&FdoDeviceExtension->DeviceListLock, &OldIrql); - RemoveEntryList(&DeviceExtension->PciDevice->ListEntry); - FdoDeviceExtension->DeviceListCount--; - KeReleaseSpinLock(&FdoDeviceExtension->DeviceListLock, OldIrql); - - /* Free the device */ - ExFreePoolWithTag(DeviceExtension->PciDevice, TAG_PCI); - - /* Complete the IRP */ - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - /* Delete the DO */ - IoDeleteDevice(DeviceObject); - return STATUS_SUCCESS; - } - case IRP_MN_QUERY_INTERFACE: DPRINT("IRP_MN_QUERY_INTERFACE received\n"); Status = PdoQueryInterface(DeviceObject, Irp, IrpSp);