mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
MdeModulePkg/SMM: Disallow unregister SMI handler in other SMI handler
In last patch, we add code support to unregister SMI handler inside itself. However, the code doesn't support unregister SMI handler insider other SMI handler. While this is not a must-have usage. So add check to disallow unregister SMI handler in other SMI handler. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com> Message-Id: <20240301030133.628-3-zhiguang.liu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
ae1079b386
commit
17b2872200
@ -8,7 +8,8 @@
|
||||
|
||||
#include "PiSmmCore.h"
|
||||
|
||||
LIST_ENTRY mSmiEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mSmiEntryList);
|
||||
SMI_HANDLER *mCurrentSmiHandler = NULL;
|
||||
LIST_ENTRY mSmiEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mSmiEntryList);
|
||||
|
||||
SMI_ENTRY mRootSmiEntry = {
|
||||
SMI_ENTRY_SIGNATURE,
|
||||
@ -142,13 +143,18 @@ SmiManage (
|
||||
// Link points to may be freed if unregister SMI handler.
|
||||
//
|
||||
Link = Link->ForwardLink;
|
||||
|
||||
Status = SmiHandler->Handler (
|
||||
(EFI_HANDLE)SmiHandler,
|
||||
Context,
|
||||
CommBuffer,
|
||||
CommBufferSize
|
||||
);
|
||||
//
|
||||
// Assign gCurrentSmiHandle before calling the SMI handler and
|
||||
// set to NULL when it returns.
|
||||
//
|
||||
mCurrentSmiHandler = SmiHandler;
|
||||
Status = SmiHandler->Handler (
|
||||
(EFI_HANDLE)SmiHandler,
|
||||
Context,
|
||||
CommBuffer,
|
||||
CommBufferSize
|
||||
);
|
||||
mCurrentSmiHandler = NULL;
|
||||
|
||||
switch (Status) {
|
||||
case EFI_INTERRUPT_PENDING:
|
||||
@ -328,6 +334,13 @@ SmiHandlerUnRegister (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Do not allow to unregister SMI Handler inside other SMI Handler
|
||||
//
|
||||
if ((mCurrentSmiHandler != NULL) && (mCurrentSmiHandler != SmiHandler)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
SmiEntry = SmiHandler->SmiEntry;
|
||||
|
||||
RemoveEntryList (&SmiHandler->Link);
|
||||
|
Loading…
x
Reference in New Issue
Block a user