]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Fix issues in PdoStartDevice()
authorOwen Smith <owen.smith@cloud.com>
Thu, 14 Dec 2023 15:32:39 +0000 (15:32 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Tue, 19 Dec 2023 09:30:06 +0000 (09:30 +0000)
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@cloud.com>
src/xenvif/pdo.c

index 29d4bdd081b9c26ea5daf7f6d9ee986ea8912ec3..f23b0471da48e668e9198c4d82b44a315e223fdc 100644 (file)
@@ -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: