diff options
| author | Nick Bofferding <bofferdn@us.ibm.com> | 2018-10-19 17:32:13 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-10-23 11:40:40 -0500 |
| commit | 24f1a6c7c10b70339c61b29593247cce46416686 (patch) | |
| tree | a1659924ef38506e576cfba2e3244e1e64396910 /src/usr/fapi2 | |
| parent | 7f52979db7086c3229870b190f109ddb76cbea75 (diff) | |
| download | talos-hostboot-24f1a6c7c10b70339c61b29593247cce46416686.tar.gz talos-hostboot-24f1a6c7c10b70339c61b29593247cce46416686.zip | |
Prevent double free condition when sending attributes to FSP
Prevents message extra_data pointer from being freed twice when sendAttrsToFsp
sends synchronus FSP messages during time when FSI mailbox is disabled.
Change-Id: I7e23aaa3c9343c53493d0459e621211f506dd8fb
CQ: SW447384
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/67784
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/fapi2')
| -rw-r--r-- | src/usr/fapi2/plat_attr_override_sync.C | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/usr/fapi2/plat_attr_override_sync.C b/src/usr/fapi2/plat_attr_override_sync.C index 45c09924a..47751806a 100644 --- a/src/usr/fapi2/plat_attr_override_sync.C +++ b/src/usr/fapi2/plat_attr_override_sync.C @@ -370,7 +370,7 @@ errlHndl_t AttrOverrideSync::sendAttrsToFsp( std::vector<TARGETING::AttributeTank::AttributeSerializedChunk> & io_attributes) { - errlHndl_t l_pErr = NULL; + errlHndl_t l_pErr = nullptr; #ifndef __HOSTBOOT_RUNTIME std::vector<TARGETING::AttributeTank::AttributeSerializedChunk>::iterator @@ -395,15 +395,22 @@ errlHndl_t AttrOverrideSync::sendAttrsToFsp( if (l_pErr) { FAPI_ERR("sendAttrsToFsp: Error sending to FSP"); + + // If mailbox nullified the extra_data, that indicates it assumed + // ownership of (and responsibility to free) the chunk data. + if(l_pMsg->extra_data == nullptr) + { + (*l_itr).iv_pAttributes = nullptr; + } msg_free(l_pMsg); - l_pMsg = NULL; + l_pMsg = nullptr; break; } - // Mailbox freed the chunk data - (*l_itr).iv_pAttributes = NULL; + // On success, assume that mailbox freed the chunk data + (*l_itr).iv_pAttributes = nullptr; msg_free(l_pMsg); - l_pMsg = NULL; + l_pMsg = nullptr; } // Free any memory (only in error case will there be memory to free) and @@ -411,7 +418,7 @@ errlHndl_t AttrOverrideSync::sendAttrsToFsp( for (l_itr = io_attributes.begin(); l_itr != io_attributes.end(); ++l_itr) { free((*l_itr).iv_pAttributes); - (*l_itr).iv_pAttributes = NULL; + (*l_itr).iv_pAttributes = nullptr; } io_attributes.clear(); #endif |

