diff options
| author | Brian Silver <bsilver@us.ibm.com> | 2015-03-26 15:34:54 -0500 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-04-02 14:15:57 -0500 |
| commit | dfb1b82ade8c531ded1b22aa869a0f36f953245f (patch) | |
| tree | ffbf2c19d6eb6700306867121d303abc5fcc4600 /src/usr/ipmi | |
| parent | a67714868bafb299786e1d91508706da8fea1e36 (diff) | |
| download | talos-hostboot-dfb1b82ade8c531ded1b22aa869a0f36f953245f.tar.gz talos-hostboot-dfb1b82ade8c531ded1b22aa869a0f36f953245f.zip | |
Reject IPMI events which aren't destined for the host
Change-Id: I378e0763c5ca8c13830d0e6c057b24e6beb5dc8c
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16671
Tested-by: Jenkins Server
Reviewed-by: WILLIAM G. HOFFA <wghoffa@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
| -rw-r--r-- | src/usr/ipmi/ipmirp.C | 92 |
1 files changed, 57 insertions, 35 deletions
diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C index 5925d4564..de1b219cd 100644 --- a/src/usr/ipmi/ipmirp.C +++ b/src/usr/ipmi/ipmirp.C @@ -331,46 +331,68 @@ void IpmiRP::postEvent(IPMI::oemSEL* i_event) { // Called in the context of the RP message loop, mutex locked - // Check to see if this event has a queue registered - IPMI::event_q_t::iterator it = iv_eventq.find(i_event->iv_cmd[0]); + do { + // Check to see if event is valid. AMI recomends we check the netfun, + // the SEL id, and the record id. If they don't match, we're allowed + // to consider this an unhandled message. + if ( (i_event->iv_netfun != IPMI::OEM_VALID_NETFUN) || + (i_event->iv_record != IPMI::OEM_VALID_SEL_ID) || + (i_event->iv_record_type != IPMI::OEM_VALID_RECORD_TYPE) ) + { + IPMI_TRAC("rejecting event netfun: 0x%x record: 0x%x record type: 0x%x cmd: 0x%x", + i_event->iv_netfun, + i_event->iv_record, + i_event->iv_record_type, + i_event->iv_cmd[0]); - msg_q_t outq = (it == iv_eventq.end()) ? iv_last_chanceq : it->second; + // ... and clean up the memory for the caller + delete i_event; + break; + } - // Create a message to send asynchronously to the event handler queue - // Assign the event to the message, the caller will delete the message - // and the event. - msg_t* msg = msg_allocate(); - msg->type = IPMI::TYPE_EVENT; - msg->extra_data = i_event; + // Check to see if this event has a queue registered + IPMI::event_q_t::iterator it = iv_eventq.find(i_event->iv_cmd[0]); + msg_q_t outq = (it == iv_eventq.end()) ? iv_last_chanceq : it->second; - IPMI_TRAC("queuing event %x:%x for handler", - i_event->iv_netfun, i_event->iv_cmd[0]) - int rc = msg_send(outq, msg); + // Create a message to send asynchronously to the event handler queue + // Assign the event to the message, the caller will delete the message + // and the event. + msg_t* msg = msg_allocate(); + msg->type = IPMI::TYPE_EVENT; + msg->extra_data = i_event; - if (rc) - { - /* @errorlog tag - * @errortype ERRL_SEV_UNRECOVERABLE - * @moduleid IPMI::MOD_IPMISRV_SEND - * @reasoncode IPMI::RC_INVALID_SEND - * @userdata1 rc from msq_send() - * @devdesc msg_send() failed - * @custdesc Firmware error during IPMI event handling - */ - errlHndl_t err = - new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, - IPMI::MOD_IPMISRV_SEND, - IPMI::RC_INVALID_SEND, - rc, - 0, - true); - err->collectTrace(IPMI_COMP_NAME); - errlCommit(err, IPMI_COMP_ID); + IPMI_TRAC("queuing event %x:%x for handler", + i_event->iv_netfun, i_event->iv_cmd[0]) + int rc = msg_send(outq, msg); - // ... and clean up the memory for the caller - delete i_event; - msg_free(msg); - } + if (rc) + { + /* @errorlog tag + * @errortype ERRL_SEV_UNRECOVERABLE + * @moduleid IPMI::MOD_IPMISRV_SEND + * @reasoncode IPMI::RC_INVALID_SEND + * @userdata1 rc from msq_send() + * @devdesc msg_send() failed + * @custdesc Firmware error during IPMI event handling + */ + errlHndl_t err = + new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + IPMI::MOD_IPMISRV_SEND, + IPMI::RC_INVALID_SEND, + rc, + 0, + true); + err->collectTrace(IPMI_COMP_NAME); + errlCommit(err, IPMI_COMP_ID); + + // ... and clean up the memory for the caller + delete i_event; + msg_free(msg); + } + + } while(0); + + return; } /** |

