[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3f03a8d0-c056-4c46-8f98-a5b5f48c6159@huawei.com>
Date: Mon, 19 May 2025 23:30:29 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Wentao Liang <vulab@...as.ac.cn>, <shenjian15@...wei.com>,
<salil.mehta@...wei.com>, <andrew+netdev@...n.ch>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <shaojijie@...wei.com>, <horms@...nel.org>, <lanhao@...wei.com>,
<wangpeiyang1@...wei.com>, <rosenp@...il.com>, <liuyonglong@...wei.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<stable@...r.kernel.org>
Subject: Re: [PATCH] net: hns3: Add error handling for VLAN filter hardware
configuration
on 2025/5/17 22:15, Wentao Liang wrote:
> 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
Hi:
Are there any real functional problems?
Would you please tell me your test cases? I'm going to try to reproduce the problem.
Thanks,
Jijie Shao
> 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);
Powered by blists - more mailing lists