From f0b1025503205515d5b105c37774596623481242 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 23 Jun 2023 16:08:25 +0100 Subject: [PATCH] [efi] Unload vetoed drivers by image handle rather than driver handle 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 --- src/interface/efi/efi_veto.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/interface/efi/efi_veto.c b/src/interface/efi/efi_veto.c index 79c157571..3e0806e01 100644 --- a/src/interface/efi/efi_veto.c +++ b/src/interface/efi/efi_veto.c @@ -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; }