[Skiboot] [PATCH] core/ipmi: Remove redundant variable
Oliver O'Halloran
oohall at gmail.com
Wed Oct 30 17:26:58 AEDT 2019
On Mon, Oct 21, 2019 at 7:02 PM Vasant Hegde
<hegdevasant at linux.vnet.ibm.com> wrote:
>
> Previous commit d75e82dbf introduced unnecessary variable/check.
> Remove that and add barrier after setting sync_msg to NULL.
>
> Cc: Oliver O'Halloran <oohall at gmail.com>
> Cc: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
> Fixes: d75e82dbf (core/ipmi: Fix use-after-free)
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
merged as of a0c996e432bc
> ---
> core/ipmi.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/core/ipmi.c b/core/ipmi.c
> index ab2931bc4..f32adb33f 100644
> --- a/core/ipmi.c
> +++ b/core/ipmi.c
> @@ -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)
> --
> 2.21.0
>
More information about the Skiboot
mailing list