Merge tag 'efi-urgent-for-v5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Borislav Petkov:
"Forwarded EFI fixes from Ard Biesheuvel:

- fix memory leak in efivarfs driver

- fix HYP mode issue in 32-bit ARM version of the EFI stub when built
in Thumb2 mode

- avoid leaking EFI pgd pages on allocation failure"

* tag 'efi-urgent-for-v5.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
efi/x86: Free efi_pgd with free_pages()
efivarfs: fix memory leak in efivarfs_create()
efi/arm: set HSCTLR Thumb2 bit correctly for HVC calls from HYP

Changed files
+17 -11
arch
arm
boot
compressed
x86
platform
efi
fs
efivarfs
+3
arch/arm/boot/compressed/head.S
··· 1472 1472 @ issued from HYP mode take us to the correct handler code. We 1473 1473 @ will disable the MMU before jumping to the kernel proper. 1474 1474 @ 1475 + ARM( bic r1, r1, #(1 << 30) ) @ clear HSCTLR.TE 1476 + THUMB( orr r1, r1, #(1 << 30) ) @ set HSCTLR.TE 1477 + mcr p15, 4, r1, c1, c0, 0 1475 1478 adr r0, __hyp_reentry_vectors 1476 1479 mcr p15, 4, r0, c12, c0, 0 @ set HYP vector base (HVBAR) 1477 1480 isb
+13 -11
arch/x86/platform/efi/efi_64.c
··· 78 78 gfp_mask = GFP_KERNEL | __GFP_ZERO; 79 79 efi_pgd = (pgd_t *)__get_free_pages(gfp_mask, PGD_ALLOCATION_ORDER); 80 80 if (!efi_pgd) 81 - return -ENOMEM; 81 + goto fail; 82 82 83 83 pgd = efi_pgd + pgd_index(EFI_VA_END); 84 84 p4d = p4d_alloc(&init_mm, pgd, EFI_VA_END); 85 - if (!p4d) { 86 - free_page((unsigned long)efi_pgd); 87 - return -ENOMEM; 88 - } 85 + if (!p4d) 86 + goto free_pgd; 89 87 90 88 pud = pud_alloc(&init_mm, p4d, EFI_VA_END); 91 - if (!pud) { 92 - if (pgtable_l5_enabled()) 93 - free_page((unsigned long) pgd_page_vaddr(*pgd)); 94 - free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); 95 - return -ENOMEM; 96 - } 89 + if (!pud) 90 + goto free_p4d; 97 91 98 92 efi_mm.pgd = efi_pgd; 99 93 mm_init_cpumask(&efi_mm); 100 94 init_new_context(NULL, &efi_mm); 101 95 102 96 return 0; 97 + 98 + free_p4d: 99 + if (pgtable_l5_enabled()) 100 + free_page((unsigned long)pgd_page_vaddr(*pgd)); 101 + free_pgd: 102 + free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER); 103 + fail: 104 + return -ENOMEM; 103 105 } 104 106 105 107 /*
+1
fs/efivarfs/super.c
··· 21 21 static void efivarfs_evict_inode(struct inode *inode) 22 22 { 23 23 clear_inode(inode); 24 + kfree(inode->i_private); 24 25 } 25 26 26 27 static const struct super_operations efivarfs_ops = {