lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250517141514.800-1-vulab@iscas.ac.cn>
Date: Sat, 17 May 2025 22:15:14 +0800
From: Wentao Liang <vulab@...as.ac.cn>
To: shenjian15@...wei.com,
	salil.mehta@...wei.com,
	shaojijie@...wei.com,
	andrew+netdev@...n.ch,
	davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com
Cc: horms@...nel.org,
	lanhao@...wei.com,
	wangpeiyang1@...wei.com,
	rosenp@...il.com,
	liuyonglong@...wei.com,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Wentao Liang <vulab@...as.ac.cn>,
	stable@...r.kernel.org
Subject: [PATCH] net: hns3: Add error handling for VLAN filter hardware configuration

The hclge_rm_vport_vlan_table() calls hclge_set_vlan_filter_hw() but does
not check the return value. This could lead to execution with potentially
invalid data. A proper implementation can be found in
hclge_add_vport_all_vlan_table().

Add error handling after calling hclge_set_vlan_filter_hw(). If
hclge_set_vlan_filter_hw() fails, log an error message via dev_err() and
return.

Fixes: c6075b193462 ("net: hns3: Record VF vlan tables")
Cc: stable@...r.kernel.org # v5.1
Signed-off-by: Wentao Liang <vulab@...as.ac.cn>
---
 .../hisilicon/hns3/hns3pf/hclge_main.c        | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index db7845009252..5ab4c7f63766 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -10141,15 +10141,23 @@ static void hclge_rm_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id,
 {
 	struct hclge_vport_vlan_cfg *vlan, *tmp;
 	struct hclge_dev *hdev = vport->back;
+	int ret;
 
 	list_for_each_entry_safe(vlan, tmp, &vport->vlan_list, node) {
 		if (vlan->vlan_id == vlan_id) {
-			if (is_write_tbl && vlan->hd_tbl_status)
-				hclge_set_vlan_filter_hw(hdev,
-							 htons(ETH_P_8021Q),
-							 vport->vport_id,
-							 vlan_id,
-							 true);
+			if (is_write_tbl && vlan->hd_tbl_status) {
+				ret = hclge_set_vlan_filter_hw(hdev,
+							       htons(ETH_P_8021Q),
+							       vport->vport_id,
+							       vlan_id,
+							       true);
+				if (ret) {
+					dev_err(&hdev->pdev->dev,
+						"restore vport vlan list failed, ret=%d\n",
+						ret);
+					return;
+				}
+			}
 
 			list_del(&vlan->node);
 			kfree(vlan);
-- 
2.42.0.windows.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ