Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp499844pxb; Wed, 15 Sep 2021 06:58:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSn7wplhtdx7Tnnl290r8c8VTfALFtBxzDarcU+iMQOiacg0PRmQd3qVNbs7ra5TNXl4CH X-Received: by 2002:a17:907:1b1b:: with SMTP id mp27mr136333ejc.538.1631714299069; Wed, 15 Sep 2021 06:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631714299; cv=none; d=google.com; s=arc-20160816; b=qeJYrMg2jUjtsZfwQAkzyMwJn2c9MZmnt1BJRJNLfrd45c2Pq2dPgHQNbFwH70ee7w jrATWaX49Vs64dcDbUm3+VjSi9gnrgso/QO54SAeg4cDJjtBwjaxwm/ZfWW2DX5ZKdaA c5UGTpA3iPHtGt+Majt6Pd38aP1L1fk02+6uciU2p0V+j7trb7qIPyKvA3rVitBCXNyR pX0yxfpM7GVmA7Ttr6EDJysYvPwkT+uYa4aCvMxHbP1f1jcp1NfYgJ1+DBET4eDmHgoJ qXr644DYSCpojO2qO4RbjkkhORgQPXvynSYCbtDGGPMKxBBgwH3jO1GSH+djQffinI4Z t6CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GQ3RGMDrWKJdA6QAovUmKbNXbOdvWkRSJfDdGu1qXaM=; b=yBxdvHBEd0pI6Q2OM+L8AZ4H3YF21g/TgdO0vDAets2i0N0LcbJJmsBSp6ab3UipnV saBJs8Z8L69FhMhEorx+JT/EDrhVG15dofyStw0BZmw9XqHhp7OJDe+T+V0iEXkO1LLH nVSJkwuZvb2ntiZj8dtjk8EWB5fakByfm9LbOjAdPyfq55A5T2jkpt8xgrzbQiGpAHbb iCkgQXDfwCF7jHMxtLYv76Q22FVNuGyhT6nfCVczy91BAXyc1X1jUo47sRQKSozNTZCL Q1P0laatfFTvNKJFVVDuaJm7w5qe+zGTm0iZLtHDUMM1sJGRhsoghUkPb4jjb4ZY3rwn hgAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ht10si61921ejc.30.2021.09.15.06.57.54; Wed, 15 Sep 2021 06:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237782AbhION5o (ORCPT + 99 others); Wed, 15 Sep 2021 09:57:44 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:16215 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234691AbhION5i (ORCPT ); Wed, 15 Sep 2021 09:57:38 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4H8hYb2mZxz1DGwc; Wed, 15 Sep 2021 21:55:15 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 15 Sep 2021 21:56:16 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 15 Sep 2021 21:56:15 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 5/6] net: hns3: check vlan id before using it Date: Wed, 15 Sep 2021 21:52:10 +0800 Message-ID: <20210915135211.9129-6-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915135211.9129-1-huangguangbin2@huawei.com> References: <20210915135211.9129-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: liaoguojia The input parameters may not be reliable, so check the vlan id before using it, otherwise may set wrong vlan id into hardware. Fixes: dc8131d846d4 ("net: hns3: Fix for packet loss due wrong filter config in VLAN tbls") Signed-off-by: liaoguojia Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index afc88a41a89c..14e9daf09f8c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -9817,6 +9817,9 @@ static int hclge_set_vlan_filter_hw(struct hclge_dev *hdev, __be16 proto, if (is_kill && !vlan_id) return 0; + if (vlan_id >= VLAN_N_VID) + return -EINVAL; + ret = hclge_set_vf_vlan_common(hdev, vport_id, is_kill, vlan_id); if (ret) { dev_err(&hdev->pdev->dev, -- 2.33.0