mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
efi_loader: abort on unsupported relocation type
If a relocation type is not supported loading the EFI binary should be aborted. Writing a message only is insufficient. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: use a() != b coding style] Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
bc188a30c6
commit
da684a646d
@@ -26,7 +26,7 @@ efi_status_t EFIAPI efi_return_handle(void *handle, efi_guid_t *protocol,
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
|
static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
|
||||||
unsigned long rel_size, void *efi_reloc)
|
unsigned long rel_size, void *efi_reloc)
|
||||||
{
|
{
|
||||||
const IMAGE_BASE_RELOCATION *end;
|
const IMAGE_BASE_RELOCATION *end;
|
||||||
@@ -63,11 +63,13 @@ static void efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
|
|||||||
default:
|
default:
|
||||||
printf("Unknown Relocation off %x type %x\n",
|
printf("Unknown Relocation off %x type %x\n",
|
||||||
offset, type);
|
offset, type);
|
||||||
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
relocs++;
|
relocs++;
|
||||||
}
|
}
|
||||||
rel = (const IMAGE_BASE_RELOCATION *)relocs;
|
rel = (const IMAGE_BASE_RELOCATION *)relocs;
|
||||||
}
|
}
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __weak invalidate_icache_all(void)
|
void __weak invalidate_icache_all(void)
|
||||||
@@ -171,7 +173,11 @@ void *efi_load_pe(void *efi, struct efi_loaded_image *loaded_image_info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Run through relocations */
|
/* Run through relocations */
|
||||||
efi_loader_relocate(rel, rel_size, efi_reloc);
|
if (efi_loader_relocate(rel, rel_size, efi_reloc) != EFI_SUCCESS) {
|
||||||
|
efi_free_pages((uintptr_t) efi_reloc,
|
||||||
|
(virt_size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Flush cache */
|
/* Flush cache */
|
||||||
flush_cache((ulong)efi_reloc,
|
flush_cache((ulong)efi_reloc,
|
||||||
|
Reference in New Issue
Block a user