[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Correct return codes during racy destruction (3).


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Mon, 14 Nov 2022 11:35:38 +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: Mon, 14 Nov 2022 11:35:59 +0000
  • Ironport-data: A9a23:HE7E+qoFJAxf6WoieY/DOiEN/9heBmJAZRIvgKrLsJaIsI4StFCzt garIBmCOK3eYTH8c40iPYrloUICupPQx99iSgA5/ywzHnwU8ZuZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYWYpAFc+E0/NsDo788YhmIlknNOlNA2Ev NL2sqX3NUSsnjV5KQr40YrawP9UlKm06W1wUmAWP6gR5gaHziVNVfrzGInqR5fGatgMdgKFb 76rIIGRpgvx4xorA9W5pbf3GmVirmn6ZFXmZtJ+AsBOszAazsAA+v9T2Mk0MC+7vw6hjdFpo OihgLTrIesf0g8gr8xGO/VQO3kW0aSrY9YrK1Dn2SCY5xWun3cBX5yCpaz5VGEV0r8fPI1Ay RAXAAEPZTyKwP2o/JGYVuQ9v5oAFcrLN6pK7xmMzRmBZRonaZXKQqGM7t5ExjYgwMtJGJ4yZ eJAN2ApNk6ZJUQSZBFHU/rSn8/x7pX7WzhRsk6Uo+w36nLNwR1Z27nxKtvFPNeNQK25m27I+ jmbpz2gUnn2MvSS8CK+3lSAgdbOlDP8VLk/Op2z1M5T1Qj7Kms7V0RNCArTTeOColG/XZdHN QkY9zQjqYA29Ve3VZ/tUhugunmGsxUAHd1KHIUHBBqlk/SOpVzDXy5dE2AHOIdOWNIKqSIC5 12Cs9quGiJTk56JRCOkqJStrhO5EH1ARYMdXhMsQQwA6tjlhYg8iBPTU9pueJKIYs3J9SLYm G7T8nVn71kHpYtSjvjgowib6965jsKRJjPZ8Dk7SY5MAulRQIe+L7Kl5lHAhRqrBNbIFwLR1 JTodiX30QzvMX1vvHbcKAnuNOvzjxpgDNE7qQAHInXZ327xk0NPhKgJiNy+TW8wWir+RRfnY VXIpSRa74JJMX2hYMdfOtzvW590kfS+SY+9B5g4i+aihbAoKWe6ENxGPxbMjwgBbmBx+U3AB XtrWZn1VitLYUiW5DG3W/0cwdcWKtMWnAvuqFGS50rP7Idyk1bOE+dYagHUPr1lhE5GyS2Mm +ti2wKx4003eIXDjuP/q+b/8XhiwaAHOK3L
  • Ironport-hdrordr: A9a23:EKWAM6EA+DedKybrpLqE4seALOsnbusQ8zAXP0AYc3Nom6uj5q WTdZUgpHjJYVkqOU3I9ersBEDiewK/yXcW2+ks1N6ZNWGM0ldARLsSibcKqAePJ8SRzIJgPN 9bAstDNOE=
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Errors in PnP retun codes found when testing under driver
verifier with mixed VM lifecycle operations. Under some
rare cases, it is possible to get more than one PnP
"remove like" operation. This results in a PnP remove
operation being processed whilst the device is already
in the deleted state.

This patch fixes the immediate cause of the bugfixes,
buy fixing the return code. Device destruction is
unchanged. Investigation into the root cause is still
ongoing.

Signed-off-by: Martin Harvey <martin.harvey@xxxxxxxxxx>
---
 src/xeniface/driver.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/xeniface/driver.c b/src/xeniface/driver.c
index db41cfe..246bf7a 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;
+            }
+            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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.