Skip to content

Commit 9f53ccf

Browse files
committed
loader-protocol: NULL output variable in load_image on failure
Ensure we don't leave the image protocol installed if there is a failure (e.g.: security violation) in the return variable that the user gave us Follow-up for 774f226
1 parent 308f380 commit 9f53ccf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

loader-proto.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ shim_load_image(BOOLEAN BootPolicy, EFI_HANDLE ParentImageHandle,
328328
return EFI_SUCCESS;
329329

330330
free_alloc:
331+
BS->UninstallMultipleProtocolInterfaces(ImageHandle,
332+
&SHIM_LOADED_IMAGE_GUID, image,
333+
&EFI_LOADED_IMAGE_GUID, &image->li,
334+
&gEfiLoadedImageDevicePathProtocolGuid,
335+
image->loaded_image_device_path,
336+
NULL);
337+
*ImageHandle = NULL;
331338
free_pages_alloc_image(image);
332339
free_image:
333340
if (image->loaded_image_device_path)

0 commit comments

Comments
 (0)