]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Continue checking for emulated type if not PCI or IDE
authorPaul Durrant <pdurrant@amazon.com>
Thu, 20 Feb 2020 09:08:41 +0000 (09:08 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 20 Feb 2020 09:08:41 +0000 (09:08 +0000)
When determining the XENFILT_EMULATED_OBJECT_TYPE, keep trying all
supplied HardwareIDs/CompatibleIDs until an exact match is made. If an
early match is made that is not a valid type, ignore the match and
continue checking for either "PCI" or "IDE".
This covers situations where XENFILTS's Parameters key contains stale
strings from previous (v8.x) versions, and fixes an upgrade failure when
upgrading v8.x to v9.x

Signed-off-by: Owen Smith <owen.smith@citrix.com>
[Re-structured]
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
src/xenfilt/driver.c

index 0167c2101f93a9c46ee30a75b6df97cf1b2c8c67..8f14ec8900170634c795aa52f4e66cd93e769b0a 100644 (file)
@@ -738,7 +738,7 @@ DriverGetEmulatedType(
     Type = XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN;
     Index = 0;
 
-    for (;;) {
+    do {
         ULONG           Length;
         PANSI_STRING    Ansi;
         NTSTATUS        status;
@@ -760,13 +760,12 @@ DriverGetEmulatedType(
                 Type = XENFILT_EMULATED_OBJECT_TYPE_IDE;
 
             RegistryFreeSzValue(Ansi);
-            break;
         } else {
             Trace("NO MATCH: %s\n", &Id[Index]);
         }
 
         Index += Length + 1;
-    }
+    } while (Type == XENFILT_EMULATED_OBJECT_TYPE_UNKNOWN);
 
     return Type;
 }