From 1a4acc11360a89ada7cda08d4b4757855bbc4f16 Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 27 Jan 2016 10:15:15 +0000 Subject: 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 Cc: Feng Tian Cc: Thomas Palmer Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng Reviewed-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19754 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Core/Dxe/Event/Event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'MdeModulePkg/Core') 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.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
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); -- cgit v1.2.3