summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2016-01-27 10:15:15 +0000
committerlzeng14 <lzeng14@Edk2>2016-01-27 10:15:15 +0000
commit1a4acc11360a89ada7cda08d4b4757855bbc4f16 (patch)
tree7b12acb5a68e1e90fca1ba3cb2fb18b062674ef9 /MdeModulePkg/Core
parent5955601cdf1ee2e9bb8a977c3cefb2d9a110797d (diff)
downloadedk2-1a4acc11360a89ada7cda08d4b4757855bbc4f16.tar.gz
edk2-1a4acc11360a89ada7cda08d4b4757855bbc4f16.tar.bz2
edk2-1a4acc11360a89ada7cda08d4b4757855bbc4f16.zip
MdeModulePkg DxeCore: Avoid the closed event to be signaled wrongly
Signal a closed event will still invoke the event notification function, it could only be exposed when no the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit set in PcdDebugPropertyMask. For example: gBS->CreateEvent ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, CallbackFun, NULL, &Event ); gBS->CloseEvent (Event); gBS->SignalEvent (Event); <- CallbackFun still be invoked Although the case to signal a closed event is abnormal, the code could still be enhanced to avoid it. Cc: Liming Gao <liming.gao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Thomas Palmer <thomas.palmer@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19754 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core')
-rw-r--r--MdeModulePkg/Core/Dxe/Event/Event.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c b/MdeModulePkg/Core/Dxe/Event/Event.c
index 34b34ac62f..01715ec3ca 100644
--- a/MdeModulePkg/Core/Dxe/Event/Event.c
+++ b/MdeModulePkg/Core/Dxe/Event/Event.c
@@ -1,7 +1,7 @@
/** @file
UEFI Event support functions implemented in this file.
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -769,6 +769,11 @@ CoreCloseEvent (
CoreUnregisterProtocolNotify (Event);
}
+ //
+ // To avoid the Event to be signalled wrongly after closed,
+ // clear the Signature of Event before free pool.
+ //
+ Event->Signature = 0;
Status = CoreFreePool (Event);
ASSERT_EFI_ERROR (Status);