author: Guojia Liao <liaoguojia@huawei.com> 2021-08-26 19:21:58 +0800
committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-09-03 10:22:57 +0200
commit: 6434d7a172723fbd0e06cc4570a0bc9a0654ac50
parent: 5d73c3788d73326b0eeae72077d4cd87446fe4c5
Commit Summary:
Diffstat:
1 file changed, 4 insertions, 1 deletion
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 00254d167904..f105ff9e3f4c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -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)