diff options
author | Michael Brown <mcb30@ipxe.org> | 2021-11-22 12:50:38 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2021-11-22 12:50:38 +0000 |
commit | a046da21a4c58365be6c029147799db974280048 (patch) | |
tree | aa6477a725fac7d50835a14b50f8078ad5036e6d | |
parent | 3ad27fbe78fec22e9af754242586f2ef621c8d2f (diff) | |
download | ipxe-a046da21a4c58365be6c029147799db974280048.zip ipxe-a046da21a4c58365be6c029147799db974280048.tar.gz ipxe-a046da21a4c58365be6c029147799db974280048.tar.bz2 |
[efi] Raise TPL during driver unload entry point
The efi_unload() function is currently missing the calls to raise and
restore the TPL. This has the side effect of causing iPXE to return
from the driver unload entry point at TPL_CALLBACK, which will cause
unexpected behaviour (typically a system lockup) shortly afterwards.
Fix by adding the missing calls to raise and restore the TPL.
Debugged-by: Petr Borsodi <petr.borsodi@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/interface/efi/efi_init.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/interface/efi/efi_init.c b/src/interface/efi/efi_init.c index b7cac16..1c6e9d4 100644 --- a/src/interface/efi/efi_init.c +++ b/src/interface/efi/efi_init.c @@ -316,9 +316,13 @@ EFI_STATUS efi_init ( EFI_HANDLE image_handle, static EFI_STATUS EFIAPI efi_unload ( EFI_HANDLE image_handle __unused ) { EFI_BOOT_SERVICES *bs = efi_systab->BootServices; EFI_SYSTEM_TABLE *systab = efi_systab; + struct efi_saved_tpl tpl; DBGC ( systab, "EFI image unloading\n" ); + /* Raise TPL */ + efi_raise_tpl ( &tpl ); + /* Shut down */ shutdown_exit(); @@ -336,6 +340,9 @@ static EFI_STATUS EFIAPI efi_unload ( EFI_HANDLE image_handle __unused ) { DBGC ( systab, "EFI image unloaded\n" ); + /* Restore TPL */ + efi_restore_tpl ( &tpl ); + return 0; } |