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

[PATCH] [XenVif] Skip stale device config...


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Tue, 7 Feb 2023 08:11:45 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Tue, 07 Feb 2023 08:12:07 +0000
  • Ironport-data: A9a23:BJAEsKLYxSBTLhGaFE+RppUlxSXFcZb7ZxGr2PjKsXjdYENS1mQAz moYUDyAbPePZ2KmLY91aIvj8kwAvJXRzd5rSQRlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHvykU7Ss1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPcwP9TlK6q4mhA5ARhPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c4sJVpzp OAjBAstdyjZoe+vwOyASa5j05FLwMnDZOvzu1llxDDdS/0nXYrCU+PB4towMDUY354UW6yEP oxANGQpNU6bC/FMEg5/5JYWm/ilgD/kdjxEqHqepLYt4niVxwt0uFToGIuIIYPUGZsP9qqej jPIoD74RT0IDeya0gPc8E2V2MrxrCyuDer+E5Xnr6U30TV/3Fc7FxwQEEOl5PW0lEO6c9ZeM FAPvDojq7Ao806mRcW7WAe3yENopTZFBYAWSbdjrljQlOyNuV3x6nU4oiBpM/gdiZ4qfhAR9 kaxxfXkHDwxi77SRifInluLlg+aNS8QJG4EQCYLSwoZ/tXuyL0OYgLzosVLS/Ds0ICscd3k6 3XT9XVl2e1P5SIe///jlW0rlQ5AsXQgouQdwgzMFlyo4QpiDGJOT9z5sAOLhRqswWvwc7Vgg JTms5LGhAztJcvX/MBofAnqNO/B2hp9GGeA6WOD5rF4n9hXx1atfJpL/BZ1L1pzP8APdFfBO RGM5FwJtMMLYyfwN8ebhr5d7OxznMDd+SnNDKiIPrKinLAhHON4wM2eTRHJhD28+KTduao+J Y2aYa6R4YUyUMxaIM6Nb75Fi9cDn3lurV4/sLinl3xLJ5LCPi/KIVrEWXPSBt0EAFSs+lmFr I0AaZvbl32ykoTWO0HqzGLaFnhSRVBTOHw8g5U/mjKrSua+JFwcNg==
  • Ironport-hdrordr: A9a23:4pvXQa9RT77qGwAmRAhuk+DnI+orL9Y04lQ7vn2ZhyYlC/Bw9v re5MjzsCWftN9/YgBEpTntAtjjfZqYz+8X3WBzB9aftWvdyQ+VxehZhOOI/9SjIU3DH4VmpM BdmsZFebvN5JtB4foSIjPULz/t+ra6GWmT69vj8w==
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

...when checking child compatibility

When a device is updated, the Enum key for the old binding is not deleted.
This can lead to a device binding that is not in use (has been replaced by
a later binding) triggering the coinstaller to fail the upgrade to a newer
version. This is especially prevelent when the older stale information was
bound to a revision that is not present in the new driver INF file.

This fix ignores the stale entries under the Enum key when performing the
compatibility checks.

This is similar to the XenBus commit 16c8ad0c446eded7246cc5f3d72de0bc3ff7baf5
which handles the same failure for XenBus's child devices

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 src/coinst/coinst.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index 489e600..403eac8 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -502,7 +502,8 @@ fail1:
 static BOOLEAN
 GetDriverKeyName(
     IN  HKEY    DeviceKey,
-    OUT PTCHAR  *Name
+    OUT PTCHAR  *Name,
+    OUT DWORD   *ConfigFlags
     )
 {
     HRESULT     Error;
@@ -513,6 +514,7 @@ GetDriverKeyName(
     DWORD       Index;
     HKEY        SubKey;
     PTCHAR      DriverKeyName;
+    DWORD       Flags;
 
     Error = RegQueryInfoKey(DeviceKey,
                             NULL,
@@ -539,9 +541,11 @@ GetDriverKeyName(
 
     SubKey = NULL;
     DriverKeyName = NULL;
+    Flags = 0;
 
     for (Index = 0; Index < SubKeys; Index++) {
         DWORD       MaxValueLength;
+        DWORD       ConfigFlagsLength;
         DWORD       DriverKeyNameLength;
         DWORD       Type;
 
@@ -588,6 +592,18 @@ GetDriverKeyName(
             goto fail4;
         }
 
+        ConfigFlagsLength = (DWORD)sizeof(DWORD);
+
+        Error = RegQueryValueEx(SubKey,
+                                "ConfigFlags",
+                                NULL,
+                                &Type,
+                                (LPBYTE)&Flags,
+                                &ConfigFlagsLength);
+        if (Error != ERROR_SUCCESS ||
+            Type != REG_DWORD)
+            Flags = 0;
+
         DriverKeyNameLength = MaxValueLength + sizeof (TCHAR);
 
         DriverKeyName = calloc(1, DriverKeyNameLength);
@@ -606,6 +622,7 @@ GetDriverKeyName(
 
         free(DriverKeyName);
         DriverKeyName = NULL;
+        Flags = 0;
 
         RegCloseKey(SubKey);
         SubKey = NULL;
@@ -619,6 +636,8 @@ GetDriverKeyName(
     free(SubKeyName);
 
     *Name = DriverKeyName;
+    *ConfigFlags = Flags;
+
     return TRUE;
 
 fail5:
@@ -889,6 +908,7 @@ SupportChildDrivers(
     PTCHAR      SubKeyName;
     HKEY        DeviceKey;
     PTCHAR      DriverKeyName;
+    DWORD       ConfigFlags;
     HKEY        DriverKey;
     PTCHAR      MatchingDeviceID;
     DWORD       Index;
@@ -948,20 +968,23 @@ SupportChildDrivers(
         if (!Success)
             goto fail5;
 
-        Success = GetDriverKeyName(DeviceKey, &DriverKeyName);
+        Success = GetDriverKeyName(DeviceKey, &DriverKeyName, &ConfigFlags);
         if (!Success)
             goto fail6;
 
         if (DriverKeyName == NULL)
             goto loop1;
 
+        if (ConfigFlags & 0x20)
+            goto loop2;
+
         Success = OpenDriverKey(DriverKeyName, &DriverKey);
         if (!Success)
-            goto loop2;
+            goto loop3;
 
         Success = GetMatchingDeviceID(DriverKey, &MatchingDeviceID);
         if (!Success)
-            goto loop3;
+            goto loop4;
 
         Success = SupportDeviceID(MatchingDeviceID);
         if (!Success)
@@ -969,9 +992,11 @@ SupportChildDrivers(
 
         free(MatchingDeviceID);
 
-    loop3:
+    loop4:
         RegCloseKey(DriverKey);
 
+    loop3:
+
     loop2:
         free(DriverKeyName);
 
-- 
2.39.0.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.