[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/xencons/driver.c | 12 ++++++++++++ src/xencons/fdo.c | 2 +- src/xencons/pdo.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/xencons/driver.c b/src/xencons/driver.c index 5a4d1d3..2cec799 100644 --- a/src/xencons/driver.c +++ b/src/xencons/driver.c @@ -194,8 +194,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/xencons/fdo.c b/src/xencons/fdo.c index 9904249..5640db9 100644 --- a/src/xencons/fdo.c +++ b/src/xencons/fdo.c @@ -2021,7 +2021,7 @@ FdoDispatchPnp( MinorFunction, PnpMinorFunctionName(MinorFunction)); - switch (StackLocation->MinorFunction) { + switch (MinorFunction) { case IRP_MN_START_DEVICE: status = FdoStartDevice(Fdo, Irp); break; diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c index d7db389..c9c313d 100644 --- a/src/xencons/pdo.c +++ b/src/xencons/pdo.c @@ -1271,7 +1271,7 @@ PdoDispatchPnp( MinorFunction, PnpMinorFunctionName(MinorFunction)); - switch (StackLocation->MinorFunction) { + switch (MinorFunction) { case IRP_MN_START_DEVICE: status = PdoStartDevice(Pdo, Irp); break; -- 2.25.0.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |