efi_loader: loaded images cannot be started twice
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 11 Jun 2019 17:35:20 +0000 (19:35 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Fri, 14 Jun 2019 17:18:39 +0000 (19:18 +0200)
If an image already has been started, return EFI_INVALID_PARAMETER when
StartImage() is called for the same handle again.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_boottime.c

index 251dfc4ecc41955a4e6ab917bd7c33f0b2951a48..275850a1a8f77556d0ef8e53ff120c50e807e50a 100644 (file)
@@ -2863,6 +2863,9 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
        EFI_ENTRY("%p, %p, %p", image_handle, exit_data_size, exit_data);
 
        /* Check parameters */
+       if (image_obj->header.type != EFI_OBJECT_TYPE_LOADED_IMAGE)
+               return EFI_EXIT(EFI_INVALID_PARAMETER);
+
        ret = EFI_CALL(efi_open_protocol(image_handle, &efi_guid_loaded_image,
                                         &info, NULL, NULL,
                                         EFI_OPEN_PROTOCOL_GET_PROTOCOL));