Skip to contentSkip to conversation

x86/efi: Free efi_pgd with free_pages()

PATCH New Waiman Long 2 participants 2 messages Mar 22, 2018 – Mar 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/efi: Free efi_pgd with free_pages()

The efi_pgd is allocated as PGD_ALLOCATION_ORDER pages and so should also be freed as PGD_ALLOCATION_ORDER pages with free_pages().

Fixes d9e9a6418065 ("x86/mm/pti: Allocate a separate user PGD")
---
 arch/x86/platform/efi/efi_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/efi/efi_64.c +1 -1
index c310a82..f9cfbc0 100644
@@ -227,7 +227,7 @@ int __init efi_alloc_page_tables(void)
 	if (!pud) {
 		if (CONFIG_PGTABLE_LEVELS > 4)
 			free_page((unsigned long) pgd_page_vaddr(*pgd));
-		free_page((unsigned long)efi_pgd);
+		free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
 		return -ENOMEM;
 	}
 
Signature · 1 line
1.8.3.1
#1 lore raw
x86/efi: Free efi_pgd with free_pages()
Commit-ID:  06ace26f4e6fcf747e890a39193be811777a048a
Gitweb:     https://git.kernel.org/tip/06ace26f4e6fcf747e890a39193be811777a048a
Author:     Waiman Long <[email protected]>
AuthorDate: Thu, 22 Mar 2018 15:18:53 -0400
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 23 Mar 2018 20:18:31 +0100

x86/efi: Free efi_pgd with free_pages()

The efi_pgd is allocated as PGD_ALLOCATION_ORDER pages and therefore must also be freed as PGD_ALLOCATION_ORDER pages with free_pages().

Fixes d9e9a6418065 ("x86/mm/pti: Allocate a separate user PGD")
Cc Dave Hansen <[email protected]>
Cc Ard Biesheuvel <[email protected]>
---
 arch/x86/platform/efi/efi_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/efi/efi_64.c +1 -1
index c310a8284358..f9cfbc0d1f33 100644
@@ -227,7 +227,7 @@ int __init efi_alloc_page_tables(void)
 	if (!pud) {
 		if (CONFIG_PGTABLE_LEVELS > 4)
 			free_page((unsigned long) pgd_page_vaddr(*pgd));
-		free_page((unsigned long)efi_pgd);
+		free_pages((unsigned long)efi_pgd, PGD_ALLOCATION_ORDER);
 		return -ENOMEM;
 	}