diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-05 16:55:06 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-07 21:10:04 +0200 |
commit | 84a918e8ce6cdc968a17e91768650bfe9eb8844a (patch) | |
tree | ac22a90dccc226a75dcc8d4878a5366327edd4e6 /lib/efi_loader/efi_boottime.c | |
parent | e7c3cd6b67d87383fa48b41c1b4037b75ceab597 (diff) |
efi_loader: LoadImage() check parent image
If the parent image handle does not refer to a loaded image return
EFI_INVALID_PARAMETER.
(UEFI SCT II 2017: 3.4.1 LoadImage() - 5.1.4.1.1)
Mark our root node as a loaded image to avoid an error when using it as
parent image.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_loader/efi_boottime.c')
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 6d86dafc16..ef9e378189 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -1760,7 +1760,7 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy, EFI_ENTRY("%d, %p, %pD, %p, %zd, %p", boot_policy, parent_image, file_path, source_buffer, source_size, image_handle); - if (!image_handle || !parent_image) { + if (!image_handle || !efi_search_obj(parent_image)) { ret = EFI_INVALID_PARAMETER; goto error; } @@ -1769,6 +1769,11 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy, ret = EFI_NOT_FOUND; goto error; } + /* The parent image handle must refer to a loaded image */ + if (!parent_image->type) { + ret = EFI_INVALID_PARAMETER; + goto error; + } if (!source_buffer) { ret = efi_load_image_from_path(file_path, &dest_buffer, |