diff options
author | Zhiguang Liu <zhiguang.liu@intel.com> | 2024-03-01 11:01:30 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-03-01 18:47:27 +0000 |
commit | ae1079b386a597108a8070652bf7cdaa4ec3dda3 (patch) | |
tree | 5465bbd87e13dcb345833f726c9eca06153ff092 /MdeModulePkg | |
parent | dcffad2491bc89bc4e7ea4de170c12b87e6e57fd (diff) | |
download | edk2-ae1079b386a597108a8070652bf7cdaa4ec3dda3.zip edk2-ae1079b386a597108a8070652bf7cdaa4ec3dda3.tar.gz edk2-ae1079b386a597108a8070652bf7cdaa4ec3dda3.tar.bz2 |
MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler
To support unregister SMI handler inside SMI handler itself,
get next node before SMI handler is executed, since LIST_ENTRY that
Link points to may be freed if unregister SMI handler in SMI handler
itself.
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Message-Id: <20240301030133.628-2-zhiguang.liu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Core/PiSmmCore/Smi.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCore/Smi.c index 2985f98..3489c13 100644 --- a/MdeModulePkg/Core/PiSmmCore/Smi.c +++ b/MdeModulePkg/Core/PiSmmCore/Smi.c @@ -134,8 +134,14 @@ SmiManage ( Head = &SmiEntry->SmiHandlers;
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
+ for (Link = Head->ForwardLink; Link != Head;) {
SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
+ //
+ // To support unregister SMI handler inside SMI handler itself,
+ // get next node before handler is executed, since LIST_ENTRY that
+ // Link points to may be freed if unregister SMI handler.
+ //
+ Link = Link->ForwardLink;
Status = SmiHandler->Handler (
(EFI_HANDLE)SmiHandler,
|