summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao, Jiewen <jiewen.yao@intel.com>2015-11-25 08:54:22 +0000
committervanjeff <vanjeff@Edk2>2015-11-25 08:54:22 +0000
commit94b76c954e6d37a95b8ab2753384b97d40bf4bfd (patch)
treee50bf1b866a13316d390a2e4b6c1ba877729fe6f
parent7e215c2d8ed8b1ea3b7e53a32769d64e3edccc2b (diff)
downloadedk2-platforms-94b76c954e6d37a95b8ab2753384b97d40bf4bfd.tar.xz
Uninstall LoadedImage protocol if SMM driver returns error and is unloaded.
Original code does not uninstall LoadedImage protocol if SMM driver returns error and is unloaded. It causes a wrong LoadedImage protocol existing in system. (Sync patch r18936 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com> Reviewed-by: "Zeng, Star" <star.zeng@intel.com> Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18947 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Dispatcher.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
index 81e8a0dc82..cbaf549066 100644
--- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
+++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c
@@ -881,6 +881,20 @@ SmmDispatcher (
if (EFI_ERROR(Status)){
UnregisterSmramProfileImage (DriverEntry, TRUE);
SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
+ //
+ // Uninstall LoadedImage
+ //
+ Status = gBS->UninstallProtocolInterface (
+ DriverEntry->ImageHandle,
+ &gEfiLoadedImageProtocolGuid,
+ DriverEntry->LoadedImage
+ );
+ if (!EFI_ERROR (Status)) {
+ if (DriverEntry->LoadedImage->FilePath != NULL) {
+ gBS->FreePool (DriverEntry->LoadedImage->FilePath);
+ }
+ gBS->FreePool (DriverEntry->LoadedImage);
+ }
}
REPORT_STATUS_CODE_WITH_EXTENDED_DATA (