[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:37:19 +0000
  • Authentication-results: esa4.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:37:32 +0000
  • Ironport-data: A9a23:UBMIiKDYQ7bHbBVW/3Hjw5YqxClBgxIJ4kV8jS/XYbTApGlx3zxUn TBKDz3Ub6qCYTOjed4kaInlpEoCvcXdmNE3QQY4rX1jcSlH+JHPbTi7wuUcHAvJd5GeExg3h yk6QoOdRCzhZiaE/n9BCpC48T8nk/nNHuCnYAL9EngZbRd+Tys8gg5Ulec8g4p56fC0GArIs t7pyyHlEAbNNwVcbyRFtcpvlDs15K6o4WpB4gRnDRx2lAS2e0c9Xcp3yZ6ZdxMUcqEMdsamS uDKyq2O/2+x13/B3fv8z94X2mVTKlLjFVDmZkh+AsBOsTAbzsAG6Y4pNeJ0VKtio27hc+ada jl6ncfYpQ8BZsUgkQmGOvVSO3kW0aZuoNcrLZUj2CA6IoKvn3bEmp1T4E8K0YIwxaF7Pkpk1 PoiJjUvZAGNheOryZ3nY7w57igjBJGD0II3v3hhyXfSDOo8QICFSKLPjTNa9G5u3IYUR6+YP pdHL2o0BPjDS0Qn1lM/DZskgOauwHn2aSNVuXqepLYt4niVxwt0uFToGIqKII3WGZ4E9qqej mTY2XnIDxslCIGelBmdwnWvj/PJhwquDer+E5Xnr6U30TV/3Fc7FxwQEEOl5PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yENopTZFBYAWSbdjrljQlOyEuG51G1ToUBZ+L9AZn+UXQwYk0 32Djt3rBCFmn+G8HCf1GqivkRu+Pi0cLGknbCACTBcY79SLnLzfni4jXf44Tvfr04Sd9SXYh mnT8XNg3+l7Ydsjjf3TwLzRv967SnElpCYR7x6fYG+q5xgRiGWNN93xsgizARqtwe+kori9U JoswZn2AAMmV8vleMmxrAIlQtmUCw6tamG0vLKWN8BJGvTE0yfLkXpsyD9/Plx1Fc0PZCXkZ kTe0SsIusEDZyX2MfErONrgYyjP8UQHPY24Ps04k/IUOsQhHON51HwGibGsM5DFzxF3zPBX1 WazesewF3cKYZmLPxLvL9rwENYDmEgD+I8kbcuhn0n9i+DOOSL9pHVsGALmU93VJZis+G39m +uz/ePTo/mDeIUSuhXqzLM=
  • Ironport-hdrordr: A9a23:5xhJSq9vu3RN7kI8+cBuk+DSI+orL9Y04lQ7vn2YSXRuHfBw8P re+cjztCWE7wr5N0tApTntAsS9qBDnhPxICOsqXYtKNTOO0ADDEGgL1/qH/9SKIUPDH4BmuZ uIC5IOa+HNMQ==
  • 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/xenvif/driver.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/xenvif/driver.c b/src/xenvif/driver.c
index 8bc097a..cac0cee 100644
--- a/src/xenvif/driver.c
+++ b/src/xenvif/driver.c
@@ -350,8 +350,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®.