Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2679402pxj; Mon, 31 May 2021 08:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiCSitzPi3UncbALhPNvyZBzzKGS6gjYdRxwmC9o0Hq0Z9Uwao5UdpCMtcVu+2Zg9skTHE X-Received: by 2002:a17:906:f117:: with SMTP id gv23mr9982255ejb.432.1622473555158; Mon, 31 May 2021 08:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473555; cv=none; d=google.com; s=arc-20160816; b=LqLhhXoRWzpsOnVTdSm0VkqaBlsM+Nj8MV2TjUd5rtbPIwZVi8XCLSBHa9eZc5Ekz8 Y/rUIxy+WFUXqVHhE3C0mP5GxnuGk6bYF4DRkwav8bblUmFNyPRu0MowbcM1qWusy4M4 nSU+yhdRyg8NLsAOugDVM8doAo1YZhcl/PynkPwpmKWiBzJE4OcLWvYMxBBvjFBUdCxB WJBVR2jl/LRWhWuIrNjMD+pX3JFo98+UaipC56Mfp+gTKPLDgSoVSroEnk9wyMvS+59p mN8zj3efgT6M8KiV3d0N8bP1ivcaVuQ6U4pAALnlt7fgInbfEQ5wY5WLmO/L+tyRxJUf ZtmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zRJzknzpQhZ7LsIwwLs5KwORV6d+0/+8rWAYsFxidQ0=; b=06ZdAr6OdySITu/tS9x95GX8oFmX+8ww4SQI6FbtX4Ipg4QRAqaNk173jS5fTJ70M/ QehNPWpTbQW3pTco0mljFPaGadj3mEYxzYntOclYnBDmm5616F908ABITVATjgFDNtxx bhxt44AUwbbj6EDL2qeyAuvrCiq4fw9WFXy67x6pJpzUa9HQuZZzKvTS8nmdtX/ROMVg m/Y1oIsMN0YnWEt5UbCKyEzSbxXY5No/spJFOJ8nGpqqG0hIO1R+B7eReCT1U8WAXtHU LR1mhGPRhImwypXqpzT1Xm8PxiYfwY1GavmHtdJmQn0yJBF1KyRDrZFjozZ6GmuJjRJt IOOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uADlVqSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e22si2886014edv.165.2021.05.31.08.05.32; Mon, 31 May 2021 08:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uADlVqSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232894AbhEaPGQ (ORCPT + 99 others); Mon, 31 May 2021 11:06:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:40580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232282AbhEaOIC (ORCPT ); Mon, 31 May 2021 10:08:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A24D061969; Mon, 31 May 2021 13:39:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468386; bh=qEwVxB+9KP8Lo3sPFcFtCEPaxzHUlgDG/ZzsD58swkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uADlVqSy2r4ylT57gSFv8SgQuLbFIDjPMflMRwq0ZgI0P2h9UfyaKv+sSzokJoKYH V79FYYUUWLfTM+ACx6sQ7DDpXhr0gumAi9QUaqEsBDjkeEjEcpMecWKrCfCgfatrd2 yq3FJIQU2GrNued7ly0X2K79VSPRi7HalCA69B7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiaran Zhang , Huazhong Tan , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 222/252] net: hns3: fix incorrect resp_msg issue Date: Mon, 31 May 2021 15:14:47 +0200 Message-Id: <20210531130705.545137286@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiaran Zhang [ Upstream commit a710b9ffbebaf713f7dbd4dbd9524907e5d66f33 ] In hclge_mbx_handler(), if there are two consecutive mailbox messages that requires resp_msg, the resp_msg is not cleared after processing the first message, which will cause the resp_msg data of second message incorrect. Fix it by clearing the resp_msg before processing every mailbox message. Fixes: bb5790b71bad ("net: hns3: refactor mailbox response scheme between PF and VF") Signed-off-by: Jiaran Zhang Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c index e0254672831f..2c2d53f5c56e 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c @@ -678,7 +678,6 @@ void hclge_mbx_handler(struct hclge_dev *hdev) unsigned int flag; int ret = 0; - memset(&resp_msg, 0, sizeof(resp_msg)); /* handle all the mailbox requests in the queue */ while (!hclge_cmd_crq_empty(&hdev->hw)) { if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) { @@ -706,6 +705,9 @@ void hclge_mbx_handler(struct hclge_dev *hdev) trace_hclge_pf_mbx_get(hdev, req); + /* clear the resp_msg before processing every mailbox message */ + memset(&resp_msg, 0, sizeof(resp_msg)); + switch (req->msg.code) { case HCLGE_MBX_MAP_RING_TO_VECTOR: ret = hclge_map_unmap_ring_to_vf_vector(vport, true, -- 2.30.2