There is a special implementation for mixed mode of the efi_free() function, to work around the incompatibility of the mixed mode plumbing with the prototype of the EFI FreePages boot service, which takes a 64-bit physical address as its first argument. Calling FreePages in mixed mode involves passing the mixed mode address of the FreePages code from the mixed mode version of the EFI system table, and the current code dereferences the ordinary system table instead, producing the wrong results. So fix this by using the efi_table_attr() macro. Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> --- arch/x86/boot/compressed/eboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index da04948d75ed..98477f3529f6 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -901,7 +901,8 @@ void efi_free(unsigned long size, unsigned long addr) if (efi_is_native()) efi_free_native(size, addr); else - efi64_thunk(efi_system_table()->boottime->mixed_mode.free_pages, + efi64_thunk(efi_table_attr(efi_system_table(), + boottime)->mixed_mode.free_pages, addr, 0, DIV_ROUND_UP(size, EFI_PAGE_SIZE)); } #endif -- 2.17.1