On Sun, 14 Dec 2025 at 13:09, Heinrich Schuchardt <[email protected]> wrote: > > Check that only a file-system installed on a handle for thethe
Typo here, please fix it on merge. Also can you expand the commit message a bit, explaining that load_image will eventually call efi_dp_find_obj() catching errors in that? > device-patch node immediately preceding the file path node is > used for LoadImage(). > > The test can be run with > > setenv efi_selftest load image from file > bootefi selftest > > Signed-off-by: Heinrich Schuchardt <[email protected]> > --- > The addtional test succeeds with current U-Boot but fails > after applying > > [PATCH v2] efi_loader: Trigger capsule updates with automatically generated > boot options > https://lore.kernel.org/u-boot/[email protected]/ > --- Reviewed-by: Ilias Apalodimas <[email protected]> > lib/efi_selftest/efi_selftest_loadimage.c | 45 +++++++++++++++++++++++ > 1 file changed, 45 insertions(+) > > diff --git a/lib/efi_selftest/efi_selftest_loadimage.c > b/lib/efi_selftest/efi_selftest_loadimage.c > index 24548f1ae63..967eaa58c69 100644 > --- a/lib/efi_selftest/efi_selftest_loadimage.c > +++ b/lib/efi_selftest/efi_selftest_loadimage.c > @@ -125,6 +125,44 @@ static struct { > } > }; > > +/* Incorrect file device path */ > +static struct { > + struct efi_device_path_vendor vendor; > + struct efi_device_path_controller ctrl; > + struct efi_device_path path; > + u16 file[sizeof(FILE_NAME)]; > + struct efi_device_path end; > +} __packed dp_file2 = { > + .vendor = { > + .dp = { > + .type = DEVICE_PATH_TYPE_HARDWARE_DEVICE, > + .sub_type = DEVICE_PATH_SUB_TYPE_VENDOR, > + .length = sizeof(struct efi_device_path_vendor), > + }, > + .guid = EFI_GUID(0x4f9a0ebf, 0xa179, 0x88a6, 0x25, 0x68, > + 0x10, 0x72, 0xb1, 0x93, 0x51, 0x71), > + }, > + .ctrl = { > + .dp = { > + .type = DEVICE_PATH_TYPE_HARDWARE_DEVICE, > + .sub_type = DEVICE_PATH_SUB_TYPE_CONTROLLER, > + .length = sizeof(struct efi_device_path_controller), > + }, > + .controller_number = 1, > + }, > + .path = { > + .type = DEVICE_PATH_TYPE_MEDIA_DEVICE, > + .sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH, > + .length = sizeof(struct efi_device_path) + > sizeof(dp_file.file), > + }, > + .file = FILE_NAME, > + .end = { > + .type = DEVICE_PATH_TYPE_END, > + .sub_type = DEVICE_PATH_SUB_TYPE_END, > + .length = sizeof(struct efi_device_path), > + } > +}; > + > /* File system info */ > static struct file_system_info priv_file_system_info = { > { > @@ -517,6 +555,13 @@ static int execute(void) > return EFI_ST_FAILURE; > } > > + ret = boottime->load_image(false, handle_image, &dp_file2.vendor.dp, > + NULL, 0, &handle); > + if (ret == EFI_SUCCESS) { > + efi_st_error("Invalid file path accepted\n"); > + return EFI_ST_FAILURE; > + } > + > return EFI_ST_SUCCESS; > } > > -- > 2.51.0 >

