* [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure
@ 2026-06-29 6:40 Dawei Feng
2026-06-30 22:47 ` Yevgeny Kliteynik
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dawei Feng @ 2026-06-29 6:40 UTC (permalink / raw)
To: saeedm
Cc: leon, tariqt, mbloch, andrew+netdev, davem, edumazet, kuba,
pabeni, kliteyn, vdogaru, horms, kees, stable, netdev, linux-rdma,
linux-kernel, jianhao.xu, zilin, Dawei Feng
hws_bwc_matcher_move() allocates a replacement matcher before setting it
as the resize target. If mlx5hws_matcher_resize_set_target() fails, the
replacement matcher is not attached anywhere and is leaked.
Fix the leak by destroying the replacement matcher before returning from
the resize-target failure path.
The bug was first flagged by an experimental analysis tool we are
developing for kernel memory-management bugs while analyzing
v6.13-rc1. The tool is still under development and is not yet publicly
available. Manual inspection confirms that the bug is still
present in v7.1.1.
An x86_64 allyesconfig build showed no new warnings. As we do not have a
mlx5 HWS-capable device to test with, no runtime testing was able to be
performed.
Fixes: 2111bb970c78 ("net/mlx5: HWS, added backward-compatible API handling")
Cc: stable@vger.kernel.org
Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
index eae02bc74221..3bcf412a08c4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
@@ -205,6 +205,7 @@ static int hws_bwc_matcher_move(struct mlx5hws_bwc_matcher *bwc_matcher)
ret = mlx5hws_matcher_resize_set_target(old_matcher, new_matcher);
if (ret) {
mlx5hws_err(ctx, "Rehash error: failed setting resize target\n");
+ mlx5hws_matcher_destroy(new_matcher);
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure
2026-06-29 6:40 [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure Dawei Feng
@ 2026-06-30 22:47 ` Yevgeny Kliteynik
2026-07-01 14:38 ` Paolo Abeni
2026-07-02 7:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Yevgeny Kliteynik @ 2026-06-30 22:47 UTC (permalink / raw)
To: Dawei Feng, saeedm, tariqt
Cc: leon, mbloch, andrew+netdev, davem, edumazet, kuba, pabeni,
vdogaru, horms, kees, stable, netdev, linux-rdma, linux-kernel,
jianhao.xu, zilin
On 29-Jun-26 09:40, Dawei Feng wrote:
> hws_bwc_matcher_move() allocates a replacement matcher before setting it
> as the resize target. If mlx5hws_matcher_resize_set_target() fails, the
> replacement matcher is not attached anywhere and is leaked.
>
> Fix the leak by destroying the replacement matcher before returning from
> the resize-target failure path.
>
> The bug was first flagged by an experimental analysis tool we are
> developing for kernel memory-management bugs while analyzing
> v6.13-rc1. The tool is still under development and is not yet publicly
> available. Manual inspection confirms that the bug is still
> present in v7.1.1.
>
> An x86_64 allyesconfig build showed no new warnings. As we do not have a
> mlx5 HWS-capable device to test with, no runtime testing was able to be
> performed.
>
> Fixes: 2111bb970c78 ("net/mlx5: HWS, added backward-compatible API handling")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
> index eae02bc74221..3bcf412a08c4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/bwc.c
> @@ -205,6 +205,7 @@ static int hws_bwc_matcher_move(struct mlx5hws_bwc_matcher *bwc_matcher)
> ret = mlx5hws_matcher_resize_set_target(old_matcher, new_matcher);
> if (ret) {
> mlx5hws_err(ctx, "Rehash error: failed setting resize target\n");
> + mlx5hws_matcher_destroy(new_matcher);
> return ret;
> }
>
Reviewed-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure
2026-06-29 6:40 [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure Dawei Feng
2026-06-30 22:47 ` Yevgeny Kliteynik
@ 2026-07-01 14:38 ` Paolo Abeni
2026-07-01 19:02 ` Tariq Toukan
2026-07-02 7:40 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2026-07-01 14:38 UTC (permalink / raw)
To: saeedm, tariqt, mbloch, leon
Cc: andrew+netdev, davem, edumazet, kuba, kliteyn, vdogaru, horms,
kees, stable, netdev, linux-rdma, linux-kernel, jianhao.xu, zilin,
Dawei Feng
On 6/29/26 8:40 AM, Dawei Feng wrote:
> hws_bwc_matcher_move() allocates a replacement matcher before setting it
> as the resize target. If mlx5hws_matcher_resize_set_target() fails, the
> replacement matcher is not attached anywhere and is leaked.
>
> Fix the leak by destroying the replacement matcher before returning from
> the resize-target failure path.
>
> The bug was first flagged by an experimental analysis tool we are
> developing for kernel memory-management bugs while analyzing
> v6.13-rc1. The tool is still under development and is not yet publicly
> available. Manual inspection confirms that the bug is still
> present in v7.1.1.
>
> An x86_64 allyesconfig build showed no new warnings. As we do not have a
> mlx5 HWS-capable device to test with, no runtime testing was able to be
> performed.
>
> Fixes: 2111bb970c78 ("net/mlx5: HWS, added backward-compatible API handling")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
@nvidia team, double checking I did not miss any relevant communication.
The last process update I recall is that one of the people listed in
maintainer file will ack patches for us to merge directly into the
net/net-next trees.
Should we consider any ack from @nvidia sufficient to take over?
Thanks,
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure
2026-07-01 14:38 ` Paolo Abeni
@ 2026-07-01 19:02 ` Tariq Toukan
0 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2026-07-01 19:02 UTC (permalink / raw)
To: Paolo Abeni, saeedm, tariqt, mbloch, leon
Cc: andrew+netdev, davem, edumazet, kuba, kliteyn, vdogaru, horms,
kees, stable, netdev, linux-rdma, linux-kernel, jianhao.xu, zilin,
Dawei Feng
On 01/07/2026 17:38, Paolo Abeni wrote:
> On 6/29/26 8:40 AM, Dawei Feng wrote:
>> hws_bwc_matcher_move() allocates a replacement matcher before setting it
>> as the resize target. If mlx5hws_matcher_resize_set_target() fails, the
>> replacement matcher is not attached anywhere and is leaked.
>>
>> Fix the leak by destroying the replacement matcher before returning from
>> the resize-target failure path.
>>
>> The bug was first flagged by an experimental analysis tool we are
>> developing for kernel memory-management bugs while analyzing
>> v6.13-rc1. The tool is still under development and is not yet publicly
>> available. Manual inspection confirms that the bug is still
>> present in v7.1.1.
>>
>> An x86_64 allyesconfig build showed no new warnings. As we do not have a
>> mlx5 HWS-capable device to test with, no runtime testing was able to be
>> performed.
>>
>> Fixes: 2111bb970c78 ("net/mlx5: HWS, added backward-compatible API handling")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>
>
> @nvidia team, double checking I did not miss any relevant communication.
> The last process update I recall is that one of the people listed in
> maintainer file will ack patches for us to merge directly into the
> net/net-next trees.
>
Ack.
> Should we consider any ack from @nvidia sufficient to take over?
>
> Thanks,
>
> Paolo
>
>
Acked-by: Tariq Toukan <tariqt@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure
2026-06-29 6:40 [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure Dawei Feng
2026-06-30 22:47 ` Yevgeny Kliteynik
2026-07-01 14:38 ` Paolo Abeni
@ 2026-07-02 7:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-02 7:40 UTC (permalink / raw)
To: Dawei Feng
Cc: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
kuba, pabeni, kliteyn, vdogaru, horms, kees, stable, netdev,
linux-rdma, linux-kernel, jianhao.xu, zilin
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 29 Jun 2026 14:40:49 +0800 you wrote:
> hws_bwc_matcher_move() allocates a replacement matcher before setting it
> as the resize target. If mlx5hws_matcher_resize_set_target() fails, the
> replacement matcher is not attached anywhere and is leaked.
>
> Fix the leak by destroying the replacement matcher before returning from
> the resize-target failure path.
>
> [...]
Here is the summary with links:
- [net] net/mlx5: HWS, fix matcher leak on resize target setup failure
https://git.kernel.org/netdev/net/c/bb09d0e64eca
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-02 7:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 6:40 [PATCH net] net/mlx5: HWS, fix matcher leak on resize target setup failure Dawei Feng
2026-06-30 22:47 ` Yevgeny Kliteynik
2026-07-01 14:38 ` Paolo Abeni
2026-07-01 19:02 ` Tariq Toukan
2026-07-02 7:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox