]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Fix ASSERT in PdoUnplugRequest
authorOwen Smith <owen.smith@cloud.com>
Fri, 3 May 2024 10:34:09 +0000 (11:34 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 May 2024 09:22:10 +0000 (10:22 +0100)
PdoUnplugRequest can be called multiple times on the same Pdo if
the child device is restarted during child device installation.
Avoid ASSERT in checked build and prevent incorrect increment of the
unplug values.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
src/xenvif/pdo.c

index 46b43a9ab8ccf0f8197fdf01f257e3e33396ab37..a3ae06180584f03e1d8a15ef0c3dbf97609ec325 100644 (file)
@@ -1234,7 +1234,11 @@ PdoUnplugRequest(
 {
     NTSTATUS        status;
 
-    ASSERT3U(Pdo->UnplugRequested, !=, Make);
+    // When a driver is restarted, PdoUnplugRequest is called again,
+    // dont increment the unplug count again.
+    if (Pdo->UnplugRequested == Make)
+        return;
+
     Pdo->UnplugRequested = Make;
 
     status = XENBUS_UNPLUG(Acquire, &Pdo->UnplugInterface);