[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:18 +0000
  • Authentication-results: esa5.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:59:32 +0000
  • Ironport-data: A9a23:UaQawaBWE0L+gxVW/3Hjw5YqxClBgxIJ4kV8jS/XYbTApDwghjxVz mZLDDyAOanZYjPxKd9wYdi/oEJVvMXWnIcyQQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nNHuCnYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtcpvlDs15K6o4WpA7gRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIw2N13HD1Wx 6wjNy1caTKvmfu9zO+1Vbw57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2o0BPjDS0Qn1lM/DZskgOauwHn2aSNVuXqepLYt4niVxwt0uFToGIqOJoHUG58I9qqej nPGz3rfJT0zCP2ekzrVy06+hNDDwTyuDer+E5Xnr6U30TV/3Fc7FxwQEEOl5PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yENopTZFBYAWSbdjrljQlOyEuG51G1ToUBZjU9w76NcEFQc1y w6Ovf/3HDdj7bOKHCf1GqivkRu+Pi0cLGknbCACTBcY79SLnLzfni4jXf44Tvfr04Sd9SXYh mnT8XNg3+l7Ydsjjf3TwLzRv967SnElpCYR7x6fYG+q5xgRiGWNN93xsgizARqtwe+kori9U JoswZb2AAMmV8vleMmxrAIlTdmUCw6tamG0vLKWN8BJGvTE0yfLkXpsyD9/Plx1Fc0PZCXkZ kTe0SsIusEMbCf0NPcvOdzhYyjP8UQHPY27Ps04k/IUOsQhHON51H0GibGsM5DFzxF3zPBX1 WazesewF3cKYZmLPxLvL9rwENYDmEgD+I8kbcuinkz6jeLHPCT9pHVsGALmU93VJZis+G39m +uz/ePTo/mDeIUSuhXqzLM=
  • Ironport-hdrordr: A9a23:Kfoiq6t70nyoqDUd42CqZemf7skDfNV00zEX/kB9WHVpmszxra +TdZMgpHrJYVcqKRYdcL+7WZVoLUmwyXcX2/hyAV7BZmnbUQKTRekIh7cKqweQfxEWndQy6U 4PScRD4aXLfDtHsfo=
  • 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/xencons/driver.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/xencons/driver.c b/src/xencons/driver.c
index 5a4d1d3..c3688c1 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;
+            }
+            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®.