summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-11-06 03:52:13 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-11-06 12:50:04 +0300
commit53def68df5ec10c9aaa46d3422c58fc85d0c93e6 (patch)
tree9ca1ad441942a83fed8ec1c8633f44f468d9a689 /lib
parent0b4cbeba593058104349a437ceb4d615e99b4019 (diff)
downloadu-boot-53def68df5ec10c9aaa46d3422c58fc85d0c93e6.tar.xz
efi_loader: AllocateAddress requires page address
AllocatePages() can be called with Type=AllocateAddress. Such a call can only succeed if *Memory points to the address of an unallocated page range. A call with *Memory being an address that is not page aligned must not succeed. The UEFI specification requires returning EFI_OUT_OF_RESOURCES if the requested pages cannot be allocated. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_memory.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index e048a545e4..a17b426d11 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -483,6 +483,8 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type,
return EFI_OUT_OF_RESOURCES;
break;
case EFI_ALLOCATE_ADDRESS:
+ if (*memory & EFI_PAGE_MASK)
+ return EFI_NOT_FOUND;
/* Exact address, reserve it. The addr is already in *memory. */
ret = efi_check_allocated(*memory, false);
if (ret != EFI_SUCCESS)