]> git.ipfire.org Git - thirdparty/grub.git/commit
kern/efi/mm: Change grub_efi_allocate_pages_real() to call semantically correct free...
authorMate Kukri <mate.kukri@canonical.com>
Wed, 12 Jun 2024 15:10:50 +0000 (16:10 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 20 Jun 2024 13:33:16 +0000 (15:33 +0200)
commit61f1d0a612a01c2f48f718ff04590ff481e028f8
tree6b06351e8b13753b16c844e325c6b94affb62edf
parentdc0a3a27d67a6b1639d155cc69e8537077af1047
kern/efi/mm: Change grub_efi_allocate_pages_real() to call semantically correct free function

If the firmware happens to return 0 as an address of allocated pages,
grub_efi_allocate_pages_real() tries to allocate a new set of pages,
and then free the ones at address 0.

However at that point grub_efi_store_alloc() wasn't yet called, so
freeing the pages at 0 using grub_efi_free_pages() which calls
grub_efi_drop_alloc() isn't necessary, so let's call b->free_pages()
instead.

The call to grub_efi_drop_alloc() doesn't seem particularly harmful,
because it seems to do nothing if the allocation it is asked to drop
isn't on the list, but the call to it is obviously unnecessary here.

Signed-off-by: Mate Kukri <mate.kukri@canonical.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/kern/efi/mm.c