]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Unload vetoed drivers by image handle rather than driver handle
authorMichael Brown <mcb30@ipxe.org>
Fri, 23 Jun 2023 15:08:25 +0000 (16:08 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 23 Jun 2023 15:51:10 +0000 (16:51 +0100)
In most cases, the driver handle will be the image handle itself.
However, this is not required by the UEFI specification, and some
images will install multiple driver binding handles.

Use the image handle (extracted from the driver binding protocol
instance) when attempting to unload the driver's image.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_veto.c

index 79c157571527a06314975f966a12aca99039f160..3e0806e019c98cc227a2acca75faad169384cee8 100644 (file)
@@ -78,14 +78,17 @@ struct efi_veto {
 static int efi_veto_unload ( struct efi_veto *veto ) {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        EFI_HANDLE driver = veto->driver;
+       EFI_HANDLE image = veto->image;
        EFI_STATUS efirc;
        int rc;
 
        /* Unload the driver */
-       if ( ( efirc = bs->UnloadImage ( driver ) ) != 0 ) {
+       if ( ( efirc = bs->UnloadImage ( image ) ) != 0 ) {
                rc = -EEFI ( efirc );
-               DBGC ( driver, "EFIVETO %s could not unload: %s\n",
-                      efi_handle_name ( driver ), strerror ( rc ) );
+               DBGC ( driver, "EFIVETO %s could not unload",
+                      efi_handle_name ( driver ) );
+               DBGC ( driver, " %s: %s\n", efi_handle_name ( image ),
+                      strerror ( rc ) );
                return rc;
        }