Incorrect handling breaks device removal. The crucial point is that a
PDO in the case of a filter should always disappear when an
IRP_MN_REMOVE_DEVICE comes down the stack. It does not need to stick around
in some cases, like a true PDO.
Signed-off-by: Ghiya, Murtaza <murtazg@amazon.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
for (ListEntry = Fdo->Dx->ListEntry.Flink;
ListEntry != &Fdo->Dx->ListEntry;
ListEntry = ListEntry->Flink)
+ {
+ PXENDISK_DX Dx = CONTAINING_RECORD(ListEntry, XENDISK_DX, ListEntry);
+ PXENDISK_PDO Pdo = Dx->Pdo;
+
+ if (PdoIsMissing(Pdo))
+ continue;
+
Count++;
+ }
Size = sizeof(DEVICE_RELATIONS) + (sizeof (PDEVICE_OBJECT) * Count);
ASSERT3U(Dx->Type, ==, PHYSICAL_DEVICE_OBJECT);
+ if (PdoIsMissing(Pdo))
+ continue;
+
if (PdoGetDevicePnpState(Pdo) == Present)
PdoSetDevicePnpState(Pdo, Enumerated);
FdoAcquireMutex(Fdo);
PdoDestroy(Pdo);
FdoReleaseMutex(Fdo);
- }
+ } else if (__PdoGetDevicePnpState(Pdo) == Enumerated)
+ __PdoSetMissing(Pdo, "Device removed");
return status;