From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64A94C04AAC for ; Mon, 20 May 2019 12:53:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30F1620645 for ; Mon, 20 May 2019 12:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558356823; bh=nokEs38bjUraDYfSWIKhMLapxnq4jYlSU8FJAQUzuyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1LT0R1MTVdpkJgXul2LLF3x2VKM7Mj9CeMTZSLkmXINdzdRozylaBT/MgTN2GeRNw khVQI2zINQXv9v8gM9KJA/IrjdCDFP3Ds3+tgu+bmH1C5AXaE6FtCP8QozxYJBlpYw qWr2j4cXcmNo1m8zC3Od4OuFEt0cG6IDrOhfYz04= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733009AbfETMRU (ORCPT ); Mon, 20 May 2019 08:17:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:58240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387513AbfETMRS (ORCPT ); Mon, 20 May 2019 08:17:18 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 191BE216B7; Mon, 20 May 2019 12:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354637; bh=nokEs38bjUraDYfSWIKhMLapxnq4jYlSU8FJAQUzuyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLrPidz7Efy+KqrOUFnLOyKVayo/0tmHKr9qA7tKlRDQptnTl6N5qEo+1tBHYD3vw Ned2cl8K/GYhlLLJH85x1qEjuwGzTmFSSP8zlyXosn7gJ0wRbOqlgDRxkhZJpUVpm3 HlAjM/7HIpvJuGOqanVM0/K5qqboxaI2+MRlzdNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kiran Kolukuluru , Kamlakant Patel , Corey Minyard Subject: [PATCH 4.9 33/44] ipmi:ssif: compare block number correctly for multi-part return messages Date: Mon, 20 May 2019 14:14:22 +0200 Message-Id: <20190520115235.096491510@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115230.720347034@linuxfoundation.org> References: <20190520115230.720347034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kamlakant Patel commit 55be8658c7e2feb11a5b5b33ee031791dbd23a69 upstream. According to ipmi spec, block number is a number that is incremented, starting with 0, for each new block of message data returned using the middle transaction. Here, the 'blocknum' is data[0] which always starts from zero(0) and 'ssif_info->multi_pos' starts from 1. So, we need to add +1 to blocknum while comparing with multi_pos. Fixes: 7d6380cd40f79 ("ipmi:ssif: Fix handling of multi-part return messages"). Reported-by: Kiran Kolukuluru Signed-off-by: Kamlakant Patel Message-Id: <1556106615-18722-1-git-send-email-kamlakantp@marvell.com> [Also added a debug log if the block numbers don't match.] Signed-off-by: Corey Minyard Cc: stable@vger.kernel.org # 4.4 Signed-off-by: Greg Kroah-Hartman --- drivers/char/ipmi/ipmi_ssif.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/char/ipmi/ipmi_ssif.c +++ b/drivers/char/ipmi/ipmi_ssif.c @@ -699,12 +699,16 @@ static void msg_done_handler(struct ssif /* End of read */ len = ssif_info->multi_len; data = ssif_info->data; - } else if (blocknum != ssif_info->multi_pos) { + } else if (blocknum + 1 != ssif_info->multi_pos) { /* * Out of sequence block, just abort. Block * numbers start at zero for the second block, * but multi_pos starts at one, so the +1. */ + if (ssif_info->ssif_debug & SSIF_DEBUG_MSG) + dev_dbg(&ssif_info->client->dev, + "Received message out of sequence, expected %u, got %u\n", + ssif_info->multi_pos - 1, blocknum); result = -EIO; } else { ssif_inc_stat(ssif_info, received_message_parts);