aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi
diff options
context:
space:
mode:
authorNeelesh Gupta <neelegup@linux.vnet.ibm.com>2015-07-31 11:47:08 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-08-13 12:08:57 +1000
commit54305537911a1028afb5e15bf66e17ef8c0163ef (patch)
tree444c55eebb3f3549ecb089b392c8e31aef9f8867 /hw/ipmi
parent61b063aa15fda8de1b72e2ffe50185fd6d01e8a2 (diff)
downloadskiboot-54305537911a1028afb5e15bf66e17ef8c0163ef.zip
skiboot-54305537911a1028afb5e15bf66e17ef8c0163ef.tar.gz
skiboot-54305537911a1028afb5e15bf66e17ef8c0163ef.tar.bz2
ipmi: Fix the opal_ipmi_recv() call to handle the error path
In the error path of the OPAL function to receive the ipmi message, the function returns the error code without deleting the message containing response. Though the kernel doesn't claim this message later and continue with the subsequent ipmi commands. This leads to a scenario when there is a mismatch between the ipmi command and its response for all the subsequent ipmi commands. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Cc: Alistair Popple <alistair@popple.id.au> Acked-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-opal.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/ipmi/ipmi-opal.c b/hw/ipmi/ipmi-opal.c
index 237f8c0..1b28aa6 100644
--- a/hw/ipmi/ipmi-opal.c
+++ b/hw/ipmi/ipmi-opal.c
@@ -82,18 +82,18 @@ static int64_t opal_ipmi_recv(uint64_t interface,
if (opal_ipmi_msg->version != OPAL_IPMI_MSG_FORMAT_VERSION_1) {
prerror("OPAL IPMI: Incorrect version\n");
rc = OPAL_UNSUPPORTED;
- goto out_unlock;
+ goto out_del_msg;
}
if (interface != IPMI_DEFAULT_INTERFACE) {
prerror("IPMI: Invalid interface 0x%llx in opal_ipmi_recv\n", interface);
- rc = OPAL_EMPTY;
- goto out_unlock;
+ rc = OPAL_PARAMETER;
+ goto out_del_msg;
}
if (*msg_len - sizeof(struct opal_ipmi_msg) < msg->resp_size + 1) {
rc = OPAL_RESOURCE;
- goto out_unlock;
+ goto out_del_msg;
}
list_del(&msg->link);
@@ -115,6 +115,11 @@ static int64_t opal_ipmi_recv(uint64_t interface,
return OPAL_SUCCESS;
+out_del_msg:
+ list_del(&msg->link);
+ if (list_empty(&msgq))
+ opal_update_pending_evt(ipmi_backend->opal_event_ipmi_recv, 0);
+ ipmi_free_msg(msg);
out_unlock:
unlock(&msgq_lock);
return rc;