Skip to content

Commit

Permalink
net: hns3: fix duplicate node in VLAN list
Browse files Browse the repository at this point in the history
[ Upstream commit 94391fa ]

VLAN list should not be added duplicate VLAN node, otherwise it would
cause "add failed" when restore VLAN from VLAN list, so this patch adds
VLAN ID check before adding node into VLAN list.

Fixes: c6075b1 ("net: hns3: Record VF vlan tables")
Signed-off-by: Guojia Liao <liaoguojia@huawei.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Guojia Liao authored and gregkh committed Sep 3, 2021
1 parent 5d73c37 commit 6434d7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
Expand Up @@ -9869,7 +9869,11 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev)
static void hclge_add_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id,
bool writen_to_tbl)
{
struct hclge_vport_vlan_cfg *vlan;
struct hclge_vport_vlan_cfg *vlan, *tmp;

list_for_each_entry_safe(vlan, tmp, &vport->vlan_list, node)
if (vlan->vlan_id == vlan_id)
return;

vlan = kzalloc(sizeof(*vlan), GFP_KERNEL);
if (!vlan)
Expand Down

0 comments on commit 6434d7a

Please sign in to comment.