[efi] Drop to external TPL when unloading vetoed images

As of commit c3376f8 ("[efi] Drop to external TPL for calls to
ConnectController()"), the veto mechanism will drop to TPL_APPLICATION
for calls to DisconnectController().

Match this behaviour for calls to UnloadImage(), since that is likely
to result in calls to DisconnectController().  For example, any EDK2
driver using NetLibDefaultUnload() as its unload handler will call
DisconnectController() to disconnect itself from all handles.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2026-04-06 22:17:58 +01:00
parent 75115ee998
commit 8796d2fb06

View File

@ -79,11 +79,15 @@ 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;
struct efi_dropped_tpl tpl;
EFI_STATUS efirc;
int rc;
/* Unload the driver */
if ( ( efirc = bs->UnloadImage ( image ) ) != 0 ) {
/* Unload the driver at external TPL */
efi_drop_tpl ( &tpl );
efirc = bs->UnloadImage ( image );
efi_undrop_tpl ( &tpl );
if ( efirc != 0 ) {
rc = -EEFI ( efirc );
DBGC ( driver, "EFIVETO %s could not unload",
efi_handle_name ( driver ) );