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

[PATCH] Correct return codes during racy destruction.


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Martin Harvey <Martin.Harvey@xxxxxxxxxx>
  • Date: Tue, 8 Nov 2022 10:49:00 +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 10:49:16 +0000
  • Ironport-data: A9a23:jAEdzq6vi6QUfU7Qc+Jz5wxRtGDHchMFZxGqfqrLsTDasY5as4F+v mUdWGGDP6mOYTCmc9lwOo6x8E5TvZLdn4dmGVZvrCo0Hi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraBYnoqLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+4pwehBtC5gZkPKkT7AeH/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5mq d4ENSoJShy6ifu4m7iDcrR9o98zFZy+VG8fkikIITDxCP8nRdbIQrnQ5M8e1zA17ixMNa+AP YxDM2MpNUmeJU0UUrsUIMtWcOOAg3Dlbzxe7lKcv7Q68kDYzRBr0airO93QEjCPbZUJzh7F+ DOfl4j/KhQCc9e86XmKyS+PvrHjvxvfAbMRK7Lto5aGh3XMnzdOWXX6T2CTvvi/z1agHt5SN UEQ0i4vtrQpslymSMHnWB+1q2LCuQQTM+e8CMVjtlvLkPCNpV/EWC5UFVatdeDKqudqZyA3z Futk+rnHDI0uoWtFGO47aet+Gba1TcuEUcOYioNTA0g6tbloZ0ugh+ncuuPAJJZnfWuR2iun mniQDwWwuxK0JVVj/nTEUXv2WrEm3TfcuIiCuw7tEqB5xgxWoOqbpfABbPzvacZd9bxorVsU RE5dymiAAImV8/leM+lGr9l8FSVCxGtYVXhbaZHRcVJythU0yfLkEA5yGgWyL1VGsgFYyT1R 0TYpBlc4pReVFPzM/EoM97vUpxyl/awfTgAahwzRoMQCqWdiSfdpH0+DaJu9zyFfLcQfVEXZ s7ALJfE4YcyAqV71jumL9rxIpdyrh3TBAr7G/jG8vhQ+eHHNSbIFe9caAHmgyJQxPrsnTg5O u13b6OioyizmsWkCsUL2eb/9Ww3EEU=
  • Ironport-hdrordr: A9a23:6Q5xzKi0scV1NukQIrxaFpx9GnBQXtAji2hC6mlwRA09TySZ// rAoB19726QtN9xYgBGpTnuAsi9qB/nmKKdgrNhX4tKPjOHhILAFugLhuHfKlXbaknDH4Vmu5 uIHZITNDSJNykYsfrH
  • 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®.