Skip to content

Commit ef39d63

Browse files
liaoguojiadavem330
authored andcommitted
net: hns3: check vlan id before using it
The input parameters may not be reliable, so check the vlan id before using it, otherwise may set wrong vlan id into hardware. Fixes: dc8131d ("net: hns3: Fix for packet loss due wrong filter config in VLAN tbls") Signed-off-by: liaoguojia <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 63b1279 commit ef39d63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9817,6 +9817,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto,
98179817
if (is_kill && !vlan_id)
98189818
return 0;
98199819

9820+
if (vlan_id >= VLAN_N_VID)
9821+
return -EINVAL;
9822+
98209823
ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id);
98219824
if (ret) {
98229825
dev_err(&hdev->pdev->dev,

0 commit comments

Comments
 (0)