Commit 681cf91c authored by Yonglong Liu's avatar Yonglong Liu
Browse files

net: hns3: add barrier in vf mailbox reply process

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7OQCS


CVE: NA

----------------------------

In hclgevf_mbx_handler() and hclgevf_get_mbx_resp() functions,
there is a typical store-store and load-load scenario between
received_resp and additional_info. This patch adds barrier
to fix the problem.

Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
parent dcd93089
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -82,6 +82,9 @@ static int hclgevf_get_mbx_resp(struct hclgevf_dev *hdev, u16 code0, u16 code1,
		i++;
	}

	/* ensure additional_info will be seen after received_resp */
	smp_rmb();

	if (i >= HCLGEVF_MAX_TRY_TIMES) {
		dev_err(&hdev->pdev->dev,
			"VF could not get mbx(%u,%u) resp(=%d) from PF in %d tries\n",
@@ -240,6 +243,11 @@ void hclgevf_mbx_handler(struct hclgevf_dev *hdev)
				temp++;
			}

			/* ensure additional_info will be seen before setting
			 * received_resp
			 */
			smp_wmb();

			if (req->match_id) {
				/* If match_id is not zero, it means PF support
				 * match_id. If the match_id is right, VF get