From: Jijie Shao <shaojijie@huawei.com>
To: Wentao Liang <vulab@iscas.ac.cn>, <shenjian15@huawei.com>,
<salil.mehta@huawei.com>, <andrew+netdev@lunn.ch>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>
Cc: <shaojijie@huawei.com>, <horms@kernel.org>, <lanhao@huawei.com>,
<wangpeiyang1@huawei.com>, <rosenp@gmail.com>,
<liuyonglong@huawei.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] net: hns3: Add error handling for VLAN filter hardware configuration
Date: Mon, 19 May 2025 23:30:29 +0800 [thread overview]
Message-ID: <3f03a8d0-c056-4c46-8f98-a5b5f48c6159@huawei.com> (raw)
In-Reply-To: <20250517141514.800-1-vulab@iscas.ac.cn>
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@vger.kernel.org # v5.1
> Signed-off-by: Wentao Liang <vulab@iscas.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);
next prev parent reply other threads:[~2025-05-19 15:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-17 14:15 Wentao Liang
2025-05-19 15:30 ` Jijie Shao [this message]
[not found] ` <682BD774.007007.29338@cstnet.cn>
2025-05-20 14:37 ` [PATCH] net: hns3: Add error handling for VLAN filter hardwareconfiguration Simon Horman
2025-05-21 2:43 ` Jijie Shao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f03a8d0-c056-4c46-8f98-a5b5f48c6159@huawei.com \
--to=shaojijie@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=lanhao@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
--cc=salil.mehta@huawei.com \
--cc=shenjian15@huawei.com \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
--cc=wangpeiyang1@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®