diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c index 3cc83e3b7b..d3851fd75f 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c @@ -991,7 +991,14 @@ TryRunningQemuKernel ( ); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "%a: LoadImage(): %r\n", __FUNCTION__, Status)); - goto FreeKernelDevicePath; + if (Status != EFI_SECURITY_VIOLATION) { + goto FreeKernelDevicePath; + } + // + // From the resource allocation perspective, EFI_SECURITY_VIOLATION means + // "success", so we must roll back the image loading. + // + goto UnloadKernelImage; } //