From 31222776dbf72d2953445ce4bcc735bf196e6b4f Mon Sep 17 00:00:00 2001 From: niruiyu Date: Fri, 10 Jun 2011 03:05:40 +0000 Subject: Set *ImageHandle to NULL when LoadImage() returns EFI_ACCESS_DENIED. Signed-off-by: niruiyu Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11783 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Image/Image.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg/Core') diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index c6a7081c18..56d93ade80 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1086,6 +1086,13 @@ CoreLoadImageCommon ( OriginalFilePath ); if (EFI_ERROR (SecurityStatus) && SecurityStatus != EFI_SECURITY_VIOLATION) { + if (SecurityStatus == EFI_ACCESS_DENIED) { + // + // Image was not loaded because the platform policy prohibits the image from being loaded. + // It's the only place we could meet EFI_ACCESS_DENIED. + // + *ImageHandle = NULL; + } Status = SecurityStatus; Image = NULL; goto Done; @@ -1237,7 +1244,6 @@ Done: if (EFI_ERROR (Status)) { if (Image != NULL) { CoreUnloadAndCloseImage (Image, (BOOLEAN)(DstBuffer == 0)); - *ImageHandle = NULL; } } else if (EFI_ERROR (SecurityStatus)) { Status = SecurityStatus; -- cgit v1.2.3