Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp275966yba; Mon, 20 May 2019 08:31:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/gq94oL42GFYTVSVLAcsDXZ+p9yBVFWOwm0UOz2/3eja7i7/UkUJmFT11gv4m28sm9hL6 X-Received: by 2002:a62:36c1:: with SMTP id d184mr59771066pfa.49.1558366284277; Mon, 20 May 2019 08:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558366284; cv=none; d=google.com; s=arc-20160816; b=g+CJqfJernhH7cht/tO2akLIa4ZY3bQ/9pF2YegxXwTyjBdHxeLk2ODxWE3btOF/ih d2VQc7H5WEmbElQggD6RkBJtiajSIv50YBo0JIfOKtEhXjvgU2O+8N61szij95Iuec4E 3Nd1eXNzzIkvDFWOFyDv0FitsJ4aTibAq2B2CeGJ83Fjh0OcQodz6ttoio4SA0pg2nf0 MM9nOYxl/cLF07YN18+Onh0tJal+alNfCL7YwSwcDp/d/apJ3+aM7K016FaXSZvtoero CgqkivEFX5SHmw+Car+zY3akh8cKHl5nhTfYMiyhPBKK9/9u0Ptak27jmkcAvX7KWlKC KBWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zbgGdCVPIuOXSewXTPByHTgTgUMLyjuaUSGguMyZgyY=; b=W+dJ0kQgEjWHuJ8n4rANHbRRmDc/Iep64vIW5iZezsOJXbc+emnM0K4YgxxJnohHOD dfcvKrHVDDnp0NB5gJgNeuDuc3MTix0g7BjQJd7G0a1BfEHrddtk6oMrY21VAXGxKDZj WnMUSpEI9gMP76vbj7OjZ4Hogz+K3xnnp7bc1Ib0Wln/KGfJNFjAMgCBdyurtWLRZCew e1Hjy66t+XTO9xgJv+45h+SmLZmTEIJ2UqzCg9ZGhd6VcSfXJoCCR2FEj/cAZEk5HP8m r5+opaY2cuV8JyxRUX8KtSAHSP9MeRdlApOZ+OarA/xyviei+Jn1u00129O64p6IYIa/ yS5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="e13bgDR/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r24si17959174pgv.323.2019.05.20.08.31.08; Mon, 20 May 2019 08:31:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="e13bgDR/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388822AbfETMYZ (ORCPT + 99 others); Mon, 20 May 2019 08:24:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:39164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388796AbfETMYV (ORCPT ); Mon, 20 May 2019 08:24:21 -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 7F7BC20645; Mon, 20 May 2019 12:24:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355061; bh=Sgs9qAY+GXEt6NrUStKP3nHLtpMEpO9pltJxRwNV2Ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e13bgDR/xmQkjv0qw6CKF9Wx/j9bOx9Muk3O/Pb53AhAY9Z/T3T+IssoSuIVF9Jxa bdiIB1tcpCwkXjT33ayDzLgaKmwGOYZuFu8qHPnT6TZrOaZtJM22O5X1P9jgD9R6Vv 3jpsyZREXYNfksqEMSYJ63zh/OnJ6YBCl0VBmatI= 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.19 081/105] ipmi:ssif: compare block number correctly for multi-part return messages Date: Mon, 20 May 2019 14:14:27 +0200 Message-Id: <20190520115252.857300093@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -688,12 +688,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);