From: Star Zeng Date: Thu, 25 Jan 2018 03:20:04 +0000 (+0800) Subject: MdeModulePkg PiSmmCore: Set ForwardLink to NULL in RemoveOldEntry() X-Git-Tag: edk2-stable201903~2511 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=e434be3c9c03fde122d878a9487915db96c479ce MdeModulePkg PiSmmCore: Set ForwardLink to NULL in RemoveOldEntry() "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 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- diff --git a/MdeModulePkg/Core/PiSmmCore/Page.c b/MdeModulePkg/Core/PiSmmCore/Page.c index 8909d46a00..3699af7424 100644 --- a/MdeModulePkg/Core/PiSmmCore/Page.c +++ b/MdeModulePkg/Core/PiSmmCore/Page.c @@ -1,7 +1,7 @@ /** @file SMM Memory page management functions. - Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -246,6 +246,8 @@ RemoveOldEntry ( ) { RemoveEntryList (&Entry->Link); + Entry->Link.ForwardLink = NULL; + if (!Entry->FromStack) { InsertTailList (&mFreeMemoryMapEntryList, &Entry->Link); }