efi/x86: Free efi_pgd with free_pages()
authorArvind Sankar <nivedita@alum.mit.edu>
Tue, 10 Nov 2020 16:39:19 +0000 (11:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:29:19 +0000 (13:29 +0100)
commit9d1b5a8c720e6945834e7dc2c4c1e9916e2fb67c
tree07cc1fbce532649b87c66d08af7580adf10b85f5
parent95fafa1cb7a5e65faaeb54f678a21b95e4ea0177
efi/x86: Free efi_pgd with free_pages()

[ Upstream commit c2fe61d8be491ff8188edaf22e838f819999146b ]

Commit

  d9e9a6418065 ("x86/mm/pti: Allocate a separate user PGD")

changed the PGD allocation to allocate PGD_ALLOCATION_ORDER pages, so in
the error path it should be freed using free_pages() rather than
free_page().

Commit

    06ace26f4e6f ("x86/efi: Free efi_pgd with free_pages()")

fixed one instance of this, but missed another.

Move the freeing out-of-line to avoid code duplication and fix this bug.

Fixes: d9e9a6418065 ("x86/mm/pti: Allocate a separate user PGD")
Link: https://lore.kernel.org/r/20201110163919.1134431-1-nivedita@alum.mit.edu
Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/platform/efi/efi_64.c