]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Avoid removing filters on upgrade installations
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 20 May 2019 14:43:34 +0000 (15:43 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 20 May 2019 15:16:30 +0000 (16:16 +0100)
When upgrading XENBUS in a situation where XENVBD has made it uninstallable
(without reboot), DriverRemoveFunctionDeviceObject() in the old instance of
XENBUS will cause XENFILT to be removed as PCI and IDE upper filter. Then,
when the new instance of XENBUS starts, it will find an incompatible
version of XEN prior to adding the registery filter entries back in. Thus,
after the requested reboot XENFILT will non-functional and another reboot
will be required to re-instate it.

This patch removes the call to FiltersUninstall() from
DriverRemoveFunctionDeviceObject() and, instead, calls it from
DriverEntry() AFTER the compatibility check. This means that XENFILT will
remain installed across an upgrade and will only be removed if XENBUS
started but has no bound devices (i.e. it has actually been un-installed).

NOTE: This also fixes an unitialized pointer in FiltersUninstallClass().

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenbus/driver.c
src/xenbus/filters.c

index 50c7c5e8799c6fa0976be15abc2e075b94af2b14..0ede4ef915bbdffc104dcecfc33da81f975ea9a6 100644 (file)
@@ -296,9 +296,6 @@ DriverRemoveFunctionDeviceObject(
     RemoveEntryList(&Dx->ListEntry);
     ASSERT3U(Driver.References, !=, 0);
     References = --Driver.References;
-
-    if (References == 1)
-        FiltersUninstall();
 }
 
 //
@@ -773,6 +770,10 @@ DriverEntry(
         goto done;
     }
 
+    // Remove the filters from the registry. They will be re-instated by
+    // the first successful AddDevice.
+    FiltersUninstall();
+
     DriverObject->DriverExtension->AddDevice = DriverAddDevice;
 
     for (Index = 0; Index <= IRP_MJ_MAXIMUM_FUNCTION; Index++) {
index dfea119eb9f79a9c76dc0d1aa3fb160393c4aacd..fc2a1d8c48002d4d4db8581eecd8b388cefbc758 100644 (file)
@@ -203,7 +203,7 @@ FiltersUninstallClass(
     HANDLE          Key;
     ULONG           Type;
     ULONG           Count;
-    PANSI_STRING    Old;
+    PANSI_STRING    Old = NULL;
     ULONG           Index;
     PANSI_STRING    New;
     NTSTATUS        status;