[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] Correct return codes during racy destruction (2).
Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx> --- src/xenbus/driver.c | 12 ++++++++++++ src/xenfilt/driver.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/xenbus/driver.c b/src/xenbus/driver.c index e07de55..cd03fce 100644 --- a/src/xenbus/driver.c +++ b/src/xenbus/driver.c @@ -760,8 +760,20 @@ DriverDispatch( 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; + } + ASSERT((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/xenfilt/driver.c b/src/xenfilt/driver.c index 8a8396e..6e00485 100644 --- a/src/xenfilt/driver.c +++ b/src/xenfilt/driver.c @@ -862,8 +862,20 @@ DriverDispatch( 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; + } + ASSERT((MinorFunction != IRP_MN_CANCEL_REMOVE_DEVICE) && (MinorFunction != IRP_MN_CANCEL_STOP_DEVICE)); + } + Irp->IoStatus.Status = status; IoCompleteRequest(Irp, IO_NO_INCREMENT); goto done; -- 2.25.0.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |