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

[PATCH] Clear unplug keys if Active device is not the Vendor device



If the Vendor device is distributed by Windows Update, the update
process will queue a reboot. If the vendor device is not the active
device, then the unplug keys will not be removed before the next reboot.
The reboot will also replace the driver on the active device which
requires rebinding child devices, which cannot happen during the early
boot phase. This will lead to a 7B bugcheck because XenVbd has not been
rebound to the new version of XenBus

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

diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index 7b96f59..8e57a10 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -1361,7 +1361,8 @@ static BOOLEAN
 IsActiveDevice(
     IN  HDEVINFO            DeviceInfoSet,
     IN  PSP_DEVINFO_DATA    DeviceInfoData,
-    OUT PBOOLEAN            ActiveDevice
+    OUT PBOOLEAN            ActiveDevice,
+    OUT PBOOLEAN            VendorIsActive
     )
 {
     PTCHAR                  ActiveDeviceID;
@@ -1392,6 +1393,20 @@ IsActiveDevice(
         TRUE :
         FALSE;
 
+#ifdef VENDOR_DEVICE_ID_STR
+
+#define DRIVER_VENDOR_DEVICE_ID "PCI\\VEN_5853&DEV_" ## VENDOR_DEVICE_ID_STR 
## "&SUBSYS_C0005853&REV_01"
+
+    *VendorIsActive = (_stricmp(ActiveDeviceID, DRIVER_VENDOR_DEVICE_ID) == 0) 
?
+        TRUE :
+        FALSE;
+
+#undef DRIVER_VENDOR_DEVICE_ID
+
+#else
+    *VendorIsActive = FALSE;
+#endif
+
     free(DeviceID);
     free(InstanceID);
 
@@ -1778,21 +1793,25 @@ DifInstallPostProcess(
 {
     BOOLEAN                         NewBinding;
     BOOLEAN                         Active;
+    BOOLEAN                         VendorIsActive;
 
     Log("====>");
 
     NewBinding = (BOOLEAN)(ULONG_PTR)Context->PrivateData;
 
     Active = TRUE;
+    VendorIsActive = FALSE;
 
     (VOID) IsActiveDevice(DeviceInfoSet,
                           DeviceInfoData,
-                          &Active);
+                          &Active,
+                          &VendorIsActive);
 
     Log("Active = %s", Active ? "TRUE" : "FALSE");
     Log("NewBinding = %s", NewBinding ? "TRUE" : "FALSE");
 
-    if (Active && NewBinding) {
+    if ((Active && NewBinding) ||
+        !VendorIsActive) {
         (VOID) ClearUnplugRequest("DISKS");
         (VOID) ClearUnplugRequest("NICS");
     }
-- 
2.16.2.windows.1




 


Rackspace

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