Commit 822d3055 authored by Haibin Lu's avatar Haibin Lu Committed by mufengyan
Browse files

HNS3: Add the reliability check of guid_tbl_space.

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


CVE: NA

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

When the current code obtains the real guid tbl size, if guid_tbl_space
is less than VPORT_NUM, the driver stub value is returned. However,
the actual size of the available guid table is smaller than the value
of this parameter. Although this does not affect the function (if the
table is full, promiscuous will be enabled), debugfs will be affected,
users will be misunderstood, and the DFX capability will be affected.
This patch add the reliability check of guid_tbl_space.

Fixes: a1799222 ("UNIC: Support using MC GUID and table management")
Signed-off-by: default avatarHaibin Lu <luhaibin10@hisilicon.com>
parent 5d73ae1b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1144,7 +1144,8 @@ struct hclge_link_mode_bmap {
static inline u16 hclge_unic_real_mguid_tbl_size(struct hclge_dev *hdev)
{
	return min(HCLGE_UNIC_MC_GUID_NUM,
		   hdev->ae_dev->dev_specs.guid_tbl_space - HCLGE_VPORT_NUM);
		   (hdev->ae_dev->dev_specs.guid_tbl_space < HCLGE_VPORT_NUM ? 0 :
		    hdev->ae_dev->dev_specs.guid_tbl_space - HCLGE_VPORT_NUM));
}

int hclge_set_vport_promisc_mode(struct hclge_vport *vport, bool en_uc_pmc,
+4 −2
Original line number Diff line number Diff line
@@ -47,11 +47,13 @@ int hclge_dbg_dump_ip_spec(struct hclge_dev *hdev, char *buf, int len)

int hclge_dbg_dump_guid_spec(struct hclge_dev *hdev, char *buf, int len)
{
	u16 mc_guid_tbl_size;
	u16 guid_tbl_space = hdev->ae_dev->dev_specs.guid_tbl_space;
	u16 mc_guid_tbl_size, func_guid_tbl_size;

	mc_guid_tbl_size = hclge_unic_real_mguid_tbl_size(hdev);
	func_guid_tbl_size = mc_guid_tbl_size ? HCLGE_VPORT_NUM : guid_tbl_space;
	scnprintf(buf, len, "function guid tbl size: %u\nmc guid tbl size: %u\n",
		  HCLGE_VPORT_NUM, mc_guid_tbl_size);
		  func_guid_tbl_size, mc_guid_tbl_size);

	return 0;
}