]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/ipmi-ssif-compare-block-number-correctly-for-multi-part-return-messages.patch
drop rdma-cma-consider-scope_id-while-binding-to-ipv6-ll-.patch from 4.4, 4.9, and...
[thirdparty/kernel/stable-queue.git] / queue-4.4 / ipmi-ssif-compare-block-number-correctly-for-multi-part-return-messages.patch
1 From 55be8658c7e2feb11a5b5b33ee031791dbd23a69 Mon Sep 17 00:00:00 2001
2 From: Kamlakant Patel <kamlakantp@marvell.com>
3 Date: Wed, 24 Apr 2019 11:50:43 +0000
4 Subject: ipmi:ssif: compare block number correctly for multi-part return messages
5
6 From: Kamlakant Patel <kamlakantp@marvell.com>
7
8 commit 55be8658c7e2feb11a5b5b33ee031791dbd23a69 upstream.
9
10 According to ipmi spec, block number is a number that is incremented,
11 starting with 0, for each new block of message data returned using the
12 middle transaction.
13
14 Here, the 'blocknum' is data[0] which always starts from zero(0) and
15 'ssif_info->multi_pos' starts from 1.
16 So, we need to add +1 to blocknum while comparing with multi_pos.
17
18 Fixes: 7d6380cd40f79 ("ipmi:ssif: Fix handling of multi-part return messages").
19 Reported-by: Kiran Kolukuluru <kirank@ami.com>
20 Signed-off-by: Kamlakant Patel <kamlakantp@marvell.com>
21 Message-Id: <1556106615-18722-1-git-send-email-kamlakantp@marvell.com>
22 [Also added a debug log if the block numbers don't match.]
23 Signed-off-by: Corey Minyard <cminyard@mvista.com>
24 Cc: stable@vger.kernel.org # 4.4
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 drivers/char/ipmi/ipmi_ssif.c | 6 +++++-
29 1 file changed, 5 insertions(+), 1 deletion(-)
30
31 --- a/drivers/char/ipmi/ipmi_ssif.c
32 +++ b/drivers/char/ipmi/ipmi_ssif.c
33 @@ -695,12 +695,16 @@ static void msg_done_handler(struct ssif
34 /* End of read */
35 len = ssif_info->multi_len;
36 data = ssif_info->data;
37 - } else if (blocknum != ssif_info->multi_pos) {
38 + } else if (blocknum + 1 != ssif_info->multi_pos) {
39 /*
40 * Out of sequence block, just abort. Block
41 * numbers start at zero for the second block,
42 * but multi_pos starts at one, so the +1.
43 */
44 + if (ssif_info->ssif_debug & SSIF_DEBUG_MSG)
45 + dev_dbg(&ssif_info->client->dev,
46 + "Received message out of sequence, expected %u, got %u\n",
47 + ssif_info->multi_pos - 1, blocknum);
48 result = -EIO;
49 } else {
50 ssif_inc_stat(ssif_info, received_message_parts);