[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Correct return codes during racy destruction.
- To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
- Date: Tue, 8 Nov 2022 10:45:07 +0000
- Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
- Cc: Martin Harvey <Martin.Harvey@xxxxxxxxxx>, Martin Harvey <martin.harvey@xxxxxxxxxx>
- Delivery-date: Tue, 08 Nov 2022 10:45:30 +0000
- Ironport-data: A9a23:EaUGv69pSCBX6O81GqD2DrUD2H6TJUtcMsCJ2f8bNWPcYEJGY0x3z zQbDT+BO67ZNDT2c993aYnj/RwEsZPXzIcyHQZkrC48E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKucYHsZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ire7kIx1BjOkGlA5AZnPKgb5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklCx 8wmIxkgfCyAhvuY7LPiUfI314caeZyD0IM34hmMzBncBPciB5vCX7/L9ZlT2zJYasJmRKiEI ZBDMHw2MUqGM0Yn1lQ/UfrSmM+tj2PjcjseqFuPu6cmy2PS0BZwwP7mN9+9ltmiFZ4EwR3J+ T6uE2LRUwEbGP6yyCG++DH3qeXwuwbgAYgtLejtnhJtqALKnTFCYPEMbnOkoP/8klD7V99BJ kg8/is1sbN05EGtVsP6XRCzvDiDpBF0ZjZLO7RkskfXkPOSulvHQDhfJtJcVDA4nMMEdQIh/ 3Kbo9DoHBJDseSOUinMtY7B+FteJhMpBWMFYCYFSy4M7N/ivJw/g3rzczpzLEKmpoarQG+tm lhmuAB73uxO1pBTi81X6Hid21qRSo71ohnZD+k9dkas9UtHaYGsfOREAnCLvK8bfO51orRs1 UXoevRyDshUU/lhdwTXGo3h+Y1FAN7UWAAweXY1Q/EcG82FohZOvel4uVmS3ntBPMceYiPOa 0TOow5X75I7FCL0M/AnP9zoU5xwk/iI+THZuhf8N4QmX3SMXFXfoHEGibC4gwgBb3TAYYlgY MzGIK5A/F4RCLh9zSreegvu+eZD+83/rEuNLa3GI+OPiuPPPCPJEe5dajNjrIkRtcu5nekcy P4HX+Pi9vmVeLSWjvX/mWLLEW03EA==
- Ironport-hdrordr: A9a23:Jebo3a8rTGLfE8WK5R1uk+Ezdb1zdoMgy1knxilNoENuH/Bwxv rFoB1E73TJYW4qKRcdcKO7SdC9qBLnhOlICOwqUYtKMzOW3FdAQLsC0WKA+UyXJ8SdzJ876U 4IScEXZ7PN5DNB/KXHCXyDYrMdKa68gcKVbInlr0tFfEVPUeVN/g15AgGUHgldXw9dH6c0E5 Ka+45uuyegUW5/VLXyOlA1G8z44/HbnpPvZhALQzQ97hOVsD+u4LnmVzCFwxYlVS9Vy7tKyx mPr+W53NTojxiI8G6R64bh1eUYpDLV8KoPOCXDsLlaFtymsHfRWG0oYcz4gNlympDn1L9iqq i3nz4we8t08H/fZWezvF/k3BThyi8n7zv4xUafmmaLm72KeNsWMbswuWtiSGqr12Mw+NVnlK 5b1WOQsJRaSRvGgSTm/tDNExVnjFC9r3YumfMayyU3a/prVJZB6YgEuE9FGpYJGyz3rIghDe l1FcnZoPJba0mTYXzVtnRmhNasQnMwFBGbRVVqgL3h7xFG2HRii0cIzs0WmXkNsJo7Vplf/u zBdr9lkblfJ/VmHJ6VxN1xP/dfJla9Pi4kaljiXGgPPJt3R07wlw==
- List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
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
|