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

[PATCH 2/3] Fix issues in PdoStartDevice()



HardwareKey was not being closed in normal operation.
SoftwareKey only requires KEY_READ access.
Move DriverRequestReboot() to the point it is required to avoid a 'goto' in
the error handlers.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 src/xenvif/pdo.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index 29d4bdd..f23b047 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -1296,7 +1296,7 @@ PdoStartDevice(
         goto fail2;
 
     status = RegistryOpenSoftwareKey(__PdoGetDeviceObject(Pdo),
-                                     KEY_ALL_ACCESS,
+                                     KEY_READ,
                                      &SoftwareKey);
     if (!NT_SUCCESS(status))
         goto fail3;
@@ -1370,12 +1370,12 @@ PdoStartDevice(
 
     if (Pdo->HasAlias || !PdoUnplugRequested(Pdo)) {
         PdoUnplugRequest(Pdo, TRUE);
+        DriverRequestReboot();
 
         status = STATUS_PNP_REBOOT_REQUIRED;
         goto fail9;
     }
 
-
     //
     // If there is a stack bound then restore any settings that
     // may have been saved from an aliasing device.
@@ -1431,6 +1431,7 @@ PdoStartDevice(
 
     __FreeMibTable(Table);
 
+    RegistryCloseKey(HardwareKey);
     RegistryCloseKey(SoftwareKey);
 
     return STATUS_SUCCESS;
@@ -1438,14 +1439,9 @@ PdoStartDevice(
 fail10:
     Error("fail10\n");
 
-    __FreeMibTable(Table);
-
-    goto fail6;
-
 fail9:
     Error("fail9\n");
 
-    DriverRequestReboot();
     __FreeMibTable(Table);
 
 fail8:
-- 
2.41.0.windows.3




 


Rackspace

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