[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:34:21 +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: Mon, 14 Nov 2022 11:34:53 +0000
  • Ironport-data: A9a23:lSHkP6sHpvn10UUra4gPn3KsTufnVA5eMUV32f8akzHdYApBsoF/q tZmKWyBb6rZZWT3fth2a9jjpEoDuJ6Hn4NqQAZlrigzEyIV+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg0HVU/IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj5lv0gnRkPaoR5QaHyyFMZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMwa3M/R0yy1tOPzrPjVudsp9kkCMvUBdZK0p1g5Wmx4fcORJnCR+PB5MNC3Sd2jcdLdRrcT 5NHM3w1Nk2GOkARfAdMYH49tL7Aan3XdjRCtFOT46o++Xbe3SR60aT3McqTcduPLSlQthbD9 jiZpjSgav0cHOGbxgbV41+GurDwmzzeUo0cHuWj8tc/1TV/wURMUUZLBDNXu8KRlU+4HspBb kAZ5Ccqhawz71CwCMnwWQWip3yJtQJaXMBfe9DW8ynUlPCSuVzAQDFZEHgRM7TKqfPaWxRpl W2gw+K4NAVhseWJR3K867CwrwyLbH19wXA5WQcISg4M4t/GqY41jw7SQtsLLJNZnuEZChmrn WnU8XFWa6E7yJdSiv7lpQyvbyeE/MChc+Ij2unAsotJBCtdbZXtWYGn4EOzAR1ofNfAFQnpU JTpdqGjAAEy4XOlzn3lrAYlRuvBCxO53Nr03zZS82EJrWjFxpJaVdk4DfEXDB4B3jw4UTHoe lTPngha+YVeOnCnBYcuPdzhUJp2kfa8Toy0PhwxUjapSsEsHDJrAQk0PRLAt4wTuBVEfV4D1 WezLp/3UCdy5VVPxzuqXeYNuYLHNQhnrV4+hPnTkXya7FZpTCXPGepfagHeM7xRAWHtiFy9z uuz/vCik313ONASqAGOmWLPBTjm9UQGOK0=
  • Ironport-hdrordr: A9a23:UpS3FKk/N+fhd0E+bm7uiQm1FyTpDfIm3DAbv31ZSRFFG/Fxl6 iV88jzsiWE7Qr5OUtQ/uxoV5PgfZqxz/NICOoqTNWftWvd2FdARbsKheCJ/9SJIVybygc378 ldmsZFZOEYdWIK7vrH3A==
  • 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/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®.