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

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


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 10:59:55 +0000
  • Authentication-results: esa1.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 11:00:09 +0000
  • Ironport-data: A9a23:5zHX3Kg/+4bT46AhycBkFuq9X161OBAKZh0ujC45NGQN5FlHY01je htvWmqFbqmIZ2CmeNEnPI7k/RhUscfdyddkSQptrXozRigb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWs0N8klgZmP6oS5QeOzyB94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tRFDXMdQC2p39uJxaCKcrNxtMgAcOXkadZ3VnFIlVk1DN4jSJHHBa7L+cVZzHE7gcUm8fT2P pRDL2A1NVKZPkMJagx/5JEWxY9EglH6eidEqVTTpaMt/WXC5AdwzKLsIJzefdniqcB9zhrI/ jycpTuR7hcyEfKt5z6k/H+WmNSMlCP8Bo1KL+ex36s/6LGU7jNKU0BHPbehmtGmi0j7Q8waJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4LgEhwFjTkOyOuV/fXzVaCG4aADA7iCMobWEPl U+novmxPANqooytE2+v+pTIgTznbED5MlQ+TSMDSAIE5fzqr4cykg/DQ75fLUKlsjHmMWqum m7X9UDSk51W1JdWjPvjoTgrlhr2/vD0ohgJChI7t45Pxidwf8abaoOh8jA3Bt4Qfd/CHjFtU JXp8vVyDdzi77nXykRho81XRtlFAspp1xWN6WOD57F7q1yQF4eLJOi9IFhWfS+FyPosdz7ze 1P0sghM/pJVN3bCRfYpPd3hV5pzlfC6S4SNuhXogj1mO8YZSeN61Hs2OR74M57FzCDAbp3Ty b/EKJ3xXB72+IxszSasRvd17FPY7nlW+I4SLLilpymaPU22PyfEEepZaALWNIjULsqs+W3oz jqWDOPSoz03bQE0SnC/HVI7RbzSEUUGOA==
  • Ironport-hdrordr: A9a23:+Mc676k5Yks5DZbqb0j/dBMAibDpDfIm3DAbv31ZSRFFG/Fxl6 iV88jzsiWE7Qr5OUtQ/uxoV5PgfZqxz/NICOoqTNWftWvd2FdARbsKheCJ/9SJIVybygc378 ldmsZFZOEYdWIK7vrH3A==
  • 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 ++++++++++++
 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®.