core/ipmi: Remove redundant variable
Previous commit introduced unnecessary variable/check.
Remove that and add barrier after setting sync_msg to NULL.
Cc: Oliver O'Halloran
Cc: Mahesh Salgaonkar
Fixes: (core/ipmi: Fix use-after-free)
@@ -126,8 +126,6 @@ int ipmi_dequeue_msg(struct ipmi_msg *msg)
void ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc, struct ipmi_msg *msg)
{
- bool clr_sync_msg = false;
-
msg->cc = cc;
if (msg->cmd != cmd) {
prerror("IPMI: Incorrect cmd 0x%02x in response\n", cmd);
@@ -140,10 +138,6 @@ void ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc, struct ipmi_msg *msg)
}
msg->netfn = netfn;
- if (msg == sync_msg)
- clr_sync_msg = true;
-
-
if (cc != IPMI_CC_NO_ERROR) {
prlog(PR_DEBUG, "IPMI: Got error response. cmd=0x%x, netfn=0x%x,"
" rc=0x%02x\n", msg->cmd, msg->netfn >> 2, msg->cc);
@@ -157,8 +151,10 @@ void ipmi_cmd_done(uint8_t cmd, uint8_t netfn, uint8_t cc, struct ipmi_msg *msg)
completion functions. */
/* If this is a synchronous message flag that we are done */
- if (clr_sync_msg)
+ if (msg == sync_msg) {
sync_msg = NULL;
+ barrier();
+ }
}
void ipmi_queue_msg_sync(struct ipmi_msg *msg)
