Skip to content

Commit 2b9941e

Browse files
committed
[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.
1 parent ea4af58 commit 2b9941e

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

drivers/bus/pci/pdo.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,34 +1577,11 @@ PdoPnpControl(
15771577
case IRP_MN_STOP_DEVICE:
15781578
case IRP_MN_QUERY_REMOVE_DEVICE:
15791579
case IRP_MN_CANCEL_REMOVE_DEVICE:
1580+
case IRP_MN_REMOVE_DEVICE:
15801581
case IRP_MN_SURPRISE_REMOVAL:
15811582
Status = STATUS_SUCCESS;
15821583
break;
15831584

1584-
case IRP_MN_REMOVE_DEVICE:
1585-
{
1586-
PPDO_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
1587-
PFDO_DEVICE_EXTENSION FdoDeviceExtension = DeviceExtension->Fdo->DeviceExtension;
1588-
KIRQL OldIrql;
1589-
1590-
/* Remove it from the device list */
1591-
KeAcquireSpinLock(&FdoDeviceExtension->DeviceListLock, &OldIrql);
1592-
RemoveEntryList(&DeviceExtension->PciDevice->ListEntry);
1593-
FdoDeviceExtension->DeviceListCount--;
1594-
KeReleaseSpinLock(&FdoDeviceExtension->DeviceListLock, OldIrql);
1595-
1596-
/* Free the device */
1597-
ExFreePoolWithTag(DeviceExtension->PciDevice, TAG_PCI);
1598-
1599-
/* Complete the IRP */
1600-
Irp->IoStatus.Status = STATUS_SUCCESS;
1601-
IoCompleteRequest(Irp, IO_NO_INCREMENT);
1602-
1603-
/* Delete the DO */
1604-
IoDeleteDevice(DeviceObject);
1605-
return STATUS_SUCCESS;
1606-
}
1607-
16081585
case IRP_MN_QUERY_INTERFACE:
16091586
DPRINT("IRP_MN_QUERY_INTERFACE received\n");
16101587
Status = PdoQueryInterface(DeviceObject, Irp, IrpSp);

0 commit comments

Comments
 (0)