Revision: 19754
          http://sourceforge.net/p/edk2/code/19754
Author:   lzeng14
Date:     2016-01-27 10:15:15 +0000 (Wed, 27 Jan 2016)
Log Message:
-----------
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 <[email protected]>
Cc: Feng Tian <[email protected]>
Cc: Thomas Palmer <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>

Modified Paths:
--------------
    trunk/edk2/MdeModulePkg/Core/Dxe/Event/Event.c

Modified: trunk/edk2/MdeModulePkg/Core/Dxe/Event/Event.c
===================================================================
--- trunk/edk2/MdeModulePkg/Core/Dxe/Event/Event.c      2016-01-27 09:46:24 UTC 
(rev 19753)
+++ trunk/edk2/MdeModulePkg/Core/Dxe/Event/Event.c      2016-01-27 10:15:15 UTC 
(rev 19754)
@@ -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 @@
     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);
 


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to