From: Tariq Toukan <tariqt@nvidia.com>
To: Wentao Liang <vulab@iscas.ac.cn>,
Saeed Mahameed <saeedm@nvidia.com>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] net/mlx5e: TC, fix internal port leak when a flow is reoffloaded
Date: Sun, 8 Nov 2026 12:12:55 +0200 [thread overview]
Message-ID: <04665957-efb5-4632-878a-6a45fa1553f5@nvidia.com> (raw)
In-Reply-To: <20261103102855.1340650-1-vulab@iscas.ac.cn>
On 03/11/2026 12:28, Wentao Liang wrote:
> For a flow originating from an OVS internal port,
> mlx5e_tc_add_fdb_flow() takes a reference on the internal port and stores
> it in the flow's esw attribute.
>
> If the flow cannot be offloaded because the encap route is not available
> (-ENETUNREACH) on a multipath LAG setup, __mlx5e_add_fdb_flow() keeps the
> flow on the unready list instead of freeing it. When
> mlx5e_tc_reoffload_flows_work() retries, mlx5e_tc_add_fdb_flow() takes
> another reference and overwrites the stored pointer, so the previous
> reference is never dropped.
>
> Only look up the internal port if the flow does not hold a reference
> already; the reference is released together with the flow attributes.
>
> Fixes: 166f431ec6be ("net/mlx5e: Add indirect tc offload of ovs internal port")
> Cc: stable@vger.kernel.org
> Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> .../net/ethernet/mellanox/mlx5/core/en_tc.c | 22 ++++++++++---------
> 1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 17bd92529a44..8246378b089f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -2005,17 +2005,19 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
> goto err_out;
> }
>
> - int_port = mlx5e_tc_int_port_get(mlx5e_get_int_port_priv(priv),
> - parse_attr->filter_dev->ifindex,
> - flow_flag_test(flow, EGRESS) ?
> - MLX5E_TC_INT_PORT_EGRESS :
> - MLX5E_TC_INT_PORT_INGRESS);
> - if (IS_ERR(int_port)) {
> - err = PTR_ERR(int_port);
> - goto err_out;
> - }
> + if (!esw_attr->int_port) {
> + int_port = mlx5e_tc_int_port_get(mlx5e_get_int_port_priv(priv),
> + parse_attr->filter_dev->ifindex,
> + flow_flag_test(flow, EGRESS) ?
> + MLX5E_TC_INT_PORT_EGRESS :
> + MLX5E_TC_INT_PORT_INGRESS);
> + if (IS_ERR(int_port)) {
> + err = PTR_ERR(int_port);
> + goto err_out;
> + }
Avoid re-indenting the lookup and pushing it over 80 columns, the check
can go into the outer condition:
if (netif_is_ovs_master(parse_attr->filter_dev) &&
!esw_attr->int_port) {
Please also answer the NetDev bot's questions on how this was found and
tested.
>
> - esw_attr->int_port = int_port;
> + esw_attr->int_port = int_port;
> + }
> }
>
> err = post_process_attr(flow, attr, extack);
prev parent reply other threads:[~2026-11-08 10:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:28 Wentao Liang
2026-11-03 10:34 ` netdev-bot+sinfo
2026-11-07 12:39 ` netdev-bot+sashiko
2026-11-08 10:12 ` Tariq Toukan [this message]
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=04665957-efb5-4632-878a-6a45fa1553f5@nvidia.com \
--to=tariqt@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/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®