From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: devel@edk2.groups.io
Cc: Zhiguang Liu <zhiguang.liu@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Jiaxin Wu <jiaxin.wu@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: [edk2-devel] [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler
Date: Wed, 24 Jan 2024 12:03:01 +0800 [thread overview]
Message-ID: <20240124040301.2176-1-zhiguang.liu@intel.com> (raw)
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>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
MdeModulePkg/Core/PiSmmCore/Smi.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCore/Smi.c
index 2985f989c3..a75e52b1ae 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 unregiser 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,
--
2.31.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114251): https://edk2.groups.io/g/devel/message/114251
Mute This Topic: https://groups.io/mt/103925794/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next reply other threads:[~2024-01-24 4:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 4:03 Zhiguang Liu [this message]
2024-01-24 8:11 ` [edk2-devel] [PATCH] MdeModulePkg/SMM: Support to unregister SMI handler inside SMI handler Ni, Ray
2024-01-24 13:06 ` Laszlo Ersek
2024-01-24 16:17 ` Ni, Ray
2024-01-24 17:15 ` Felix Polyudov via groups.io
2024-01-24 17:19 ` Laszlo Ersek
2024-01-25 10:48 ` Laszlo Ersek
2024-01-25 12:05 ` Ni, Ray
2024-01-25 19:25 ` Laszlo Ersek
2024-01-26 2:17 ` Ni, Ray
2024-03-07 6:11 ` Zhiguang Liu
2024-03-07 9:06 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240124040301.2176-1-zhiguang.liu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox