]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Drop to external TPL when unloading vetoed images
authorMichael Brown <mcb30@ipxe.org>
Mon, 6 Apr 2026 21:17:58 +0000 (22:17 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 6 Apr 2026 21:17:58 +0000 (22:17 +0100)
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>
src/interface/efi/efi_veto.c

index 788515dd1337bce7ff5d11c0a445b69a3d83e370..688eb4fbaebb3fdc2609e88c6684a3dfc40598de 100644 (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 ) );