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

Re: [PATCH] Correct return codes during racy destruction.


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Paul Durrant <xadimgnik@xxxxxxxxx>
  • Date: Tue, 8 Nov 2022 11:12:23 +0000
  • Delivery-date: Tue, 08 Nov 2022 11:12:27 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

On 08/11/2022 10:49, Martin Harvey wrote:

Can we have an explanatory commit comment? How did you discover the races (since the HLK/WLK has not complained before AFAIK)? What is the fall-out of the race? BSOD?

  Paul

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;




 


Rackspace

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