|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Correct return codes during racy destruction.
Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx>
---
src/xeniface/driver.c | 12 ++++++++++++
src/xeniface/fdo.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/xeniface/driver.c b/src/xeniface/driver.c
index db41cfe..d7c73e0 100644
--- a/src/xeniface/driver.c
+++ b/src/xeniface/driver.c
@@ -108,8 +108,20 @@ Dispatch(
ASSERT3P(Dx->DeviceObject, ==, DeviceObject);
if (Dx->DevicePnpState == Deleted) {
+ PIO_STACK_LOCATION StackLocation = IoGetCurrentIrpStackLocation(Irp);
+ UCHAR MajorFunction = StackLocation->MajorFunction;
+ UCHAR MinorFunction = StackLocation->MinorFunction;
status = STATUS_NO_SUCH_DEVICE;
+ if (MajorFunction == IRP_MJ_PNP) {
+ if ((MinorFunction == IRP_MN_SURPRISE_REMOVAL) ||
+ (MinorFunction == IRP_MN_REMOVE_DEVICE)) {
+ /* FDO and PDO deletions can block after being marked deleted,
but before IoDeleteDevice */
+ status = STATUS_SUCCESS;
+ }
+ BUG_ON((MinorFunction == IRP_MN_CANCEL_REMOVE_DEVICE) ||
(MinorFunction == IRP_MN_CANCEL_STOP_DEVICE));
+ }
+
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
goto done;
diff --git a/src/xeniface/fdo.c b/src/xeniface/fdo.c
index 6aabf96..f282277 100644
--- a/src/xeniface/fdo.c
+++ b/src/xeniface/fdo.c
@@ -1498,7 +1498,7 @@ FdoDispatchPnp(
MinorFunction,
PnpMinorFunctionName(MinorFunction));
- switch (StackLocation->MinorFunction) {
+ switch (MinorFunction) {
case IRP_MN_START_DEVICE:
status = FdoStartDevice(Fdo, Irp);
break;
--
2.25.0.windows.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |