MdeModulePkg/SMM: Support to unregister SMI handler in SMI handlers
This patch fix a use-after-free issue where unregistering an SMI handler could lead to the deletion of the SMI_HANDLER while it is still in use by SmiManage(). The fix involves modifying SmiHandlerUnRegister() to detect whether it is being called from within the SmiManage() stack. If so, the removal of the SMI_HANDLER is deferred until SmiManage() has finished executing. Additionally, due to the possibility of recursive SmiManage() calls, the unregistration and subsequent removal of the SMI_HANDLER are ensured to occur only after the outermost SmiManage() invocation has completed. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
da7858117f
commit
74f6ce6734
@@ -93,6 +93,7 @@ typedef struct {
|
||||
SMI_ENTRY *SmiEntry;
|
||||
VOID *Context; // for profile
|
||||
UINTN ContextSize; // for profile
|
||||
BOOLEAN ToRemove; // To remove this SMI_HANDLER later
|
||||
} SMI_HANDLER;
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user