diff options
author | Zhiguang Liu <zhiguang.liu@intel.com> | 2024-03-01 11:01:32 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-03-01 18:47:27 +0000 |
commit | 049ff6c39c73edd3709c05bd0e46184320471358 (patch) | |
tree | 82a717f0bc6e638c528150bccf2821eed3907a65 | |
parent | 17b28722008eab745ce186b72cd325944cbe6bf0 (diff) | |
download | edk2-049ff6c39c73edd3709c05bd0e46184320471358.tar.gz edk2-049ff6c39c73edd3709c05bd0e46184320471358.tar.bz2 edk2-049ff6c39c73edd3709c05bd0e46184320471358.zip |
StandaloneMmPkg: Support to unregister MMI handler inside MMI handler
To support unregister MMI handler inside MMI handler itself,
get next node before MMI handler is executed, since LIST_ENTRY that
Link points to may be freed if unregister MMI handler in MMI 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>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Message-Id: <20240301030133.628-4-zhiguang.liu@intel.com>
-rw-r--r-- | StandaloneMmPkg/Core/Mmi.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/StandaloneMmPkg/Core/Mmi.c b/StandaloneMmPkg/Core/Mmi.c index 0de6fd17fc..c1a1d76e85 100644 --- a/StandaloneMmPkg/Core/Mmi.c +++ b/StandaloneMmPkg/Core/Mmi.c @@ -154,9 +154,14 @@ MmiManage ( Head = &MmiEntry->MmiHandlers;
}
- for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
+ for (Link = Head->ForwardLink; Link != Head;) {
MmiHandler = CR (Link, MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE);
-
+ //
+ // To support unregister MMI handler inside MMI handler itself,
+ // get next node before handler is executed, since LIST_ENTRY that
+ // Link points to may be freed if unregister MMI handler.
+ //
+ Link = Link->ForwardLink;
Status = MmiHandler->Handler (
(EFI_HANDLE)MmiHandler,
Context,
|