Jérémy Compostella has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/86038?usp=email )
Change subject: cpu/x86/smm: Fix smm_get_save_state() returning invalid pointer ......................................................................
cpu/x86/smm: Fix smm_get_save_state() returning invalid pointer
The smm_get_save_state() function is incorrectly returning a pointer to the save state for a CPU that does not exit. This is leading to a hang when to pointer is used to access the save state.
TEST=No unexpected hangs in System Management Mode (SMM) were detected on fatcat.
Change-Id: I09f969105190a004372c43cb1542f5b716da1eda Signed-off-by: Jeremy Compostella jeremy.compostella@intel.com --- M src/cpu/x86/smm/smm_module_handler.c M src/soc/intel/common/block/smm/smihandler.c 2 files changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/86038/1
diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c index 899ee2f..d25b5f4 100644 --- a/src/cpu/x86/smm/smm_module_handler.c +++ b/src/cpu/x86/smm/smm_module_handler.c @@ -106,7 +106,7 @@
void *smm_get_save_state(int cpu) { - if (cpu > smm_runtime.num_cpus) + if (cpu >= smm_runtime.num_cpus) return NULL;
return (void *)(smm_runtime.save_state_top[cpu] - diff --git a/src/soc/intel/common/block/smm/smihandler.c b/src/soc/intel/common/block/smm/smihandler.c index 59489a4..49cc6aa 100644 --- a/src/soc/intel/common/block/smm/smihandler.c +++ b/src/soc/intel/common/block/smm/smihandler.c @@ -74,6 +74,8 @@ /* Check all nodes looking for the one that issued the IO */ for (node = 0; node < CONFIG_MAX_CPUS; node++) { state = smm_get_save_state(node); + if (!state) + continue;
io_misc_info = save_state_ops->get_io_misc_info(state);