]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg PiSmmCore: Set ForwardLink to NULL in RemoveOldEntry()
authorStar Zeng <star.zeng@intel.com>
Thu, 25 Jan 2018 03:20:04 +0000 (11:20 +0800)
committerStar Zeng <star.zeng@intel.com>
Wed, 31 Jan 2018 09:23:36 +0000 (17:23 +0800)
"Entry->Link.ForwardLink = NULL;" is present in RemoveMemoryMapEntry()
for DxeCore, that is correct.
"Entry->Link.ForwardLink = NULL;" is absent in RemoveOldEntry()
for PiSmmCore, that is incorrect.

Without this fix, when FromStack in Entry is TRUE,
the "InsertTailList (&mMapStack[mMapDepth].Link, &Entry->Link);" in
following calling to CoreFreeMemoryMapStack() will fail as the entry
at mMapStack[mMapDepth] actually has been removed from the list.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
MdeModulePkg/Core/PiSmmCore/Page.c

index 8909d46a00a2170907c437f959a17b9a531f35d8..3699af7424584c33afd383b82c72c56610a7c5ab 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   SMM Memory page management functions.\r
 \r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
   distribution.  The full text of the license may be found at\r
@@ -246,6 +246,8 @@ RemoveOldEntry (
   )\r
 {\r
   RemoveEntryList (&Entry->Link);\r
+  Entry->Link.ForwardLink = NULL;\r
+\r
   if (!Entry->FromStack) {\r
     InsertTailList (&mFreeMemoryMapEntryList, &Entry->Link);\r
   }\r