[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 11:01:22 +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:05:11 +0000
  • Ironport-data: A9a23:KBF1v60+QPk1xFWR1PbD5Ytxkn2cJEfYwER7XKvMYLTBsI5bp2ZUn zEXWTrUOa3eMGLxfdxyPNjgoB4OvZfTx9IyS1BtpC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wVmNagS1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfAUIR+ e4nNjcxZFOBgLmU4fWlQ9dlmZF2RCXrFNt3VnBIyDjYCbAtQIzZQrWM7thdtNsyrpkQR7CEP ZNfMGcxKkSbC/FMEg5/5JYWme6ymnj5NT1RskyYtII84nTJzRw327/oWDbQUozWFZ0LwhzGz o7A10/7LAggbv+W9RaM2Wy92uP0gA3FB41HQdVU8dY12QbOlwT/EiY+Slq95OGnz0KzRd9bA 0gV4TY167g/8lSxSdvwVAH+p2SL1iPwQPIJTbd8slvUjPOJvUDJXQDoUwKtdvQml5A6VwM00 WOD3NHuXh5O96Ocd3uCo+L8QSyJBQAZKmoLZCkhRAQD4sX+rIxbsi8jXuqPA4bu0ISrRGiYL ySi6XFn2u5N1ZJjO7CTpwivvt66mnTeoufZDC3zV3nt0A52bZXNi2eAuQmCtqYowGp0ozC8U Jk4dyq2tr5m4XKlznblrAAx8FaBtp643MX02wIHInXY323FFr7KVdk4DMtCDEloKN0YXjTif VXevwhcjLcKYiX1PfMpOtrpUZp6pUQFKTgCfqmKBuein7ArLFPXlM2QTRL4M5/RfLgEzvhkZ MbznTeEBncGE6V3pAdatM9EuYLGB0kWmwvueHwM50/6jOvDPSbOFelt3ZnnRrlR0Z5oaT79q 753X/ZmAT0FOAEiSkE7KbIuEG0=
  • Ironport-hdrordr: A9a23:uALrVK+9wzejWpdP2jxuk+DSI+orL9Y04lQ7vn2YSXRuHfBw8P re+cjztCWE7wr5N0tApTntAsS9qBDnhPxICOsqXYtKNTOO0ADDEGgL1/qH/9SKIUPDH4BmuZ uIC5IOa+HNMQ==
  • 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/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®.