Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr()
@ 2026-11-26 13:22 Wanhui Fu
  2026-11-26 13:35 ` sashiko-bot
  2026-11-26 18:35 ` Mark Bloch
  0 siblings, 2 replies; 3+ messages in thread
From: Wanhui Fu @ 2026-11-26 13:22 UTC (permalink / raw)
  To: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
	kuba, pabeni, kliteyn, muhammads
  Cc: netdev, linux-rdma, Wanhui Fu

If xa_store() fails, the entry recalc_cs_ft has not been stored in
XArray. Therefore dr_domain_uninit_csum_recalc_fts() would not destroy
this entry. Just call mlx5dr_fw_destroy_recalc_cs_ft if xa_store() fails.

Found it by a self-developed static analysis tool and compile-test passed.

Fixes: c0e90fc2ccaa ("net/mlx5: DR, Support csum recalculation flow table on SFs")
Signed-off-by: Wanhui Fu <fuwh1120@163.com>
---
 .../net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
index fedefb565a21..3747c217b61c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
@@ -87,8 +87,10 @@ int mlx5dr_domain_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn,
 
 		ret = xa_err(xa_store(&dmn->csum_fts_xa, vport_num,
 				      recalc_cs_ft, GFP_KERNEL));
-		if (ret)
+		if (ret) {
+			mlx5dr_fw_destroy_recalc_cs_ft(dmn, recalc_cs_ft);
 			return ret;
+		}
 	}
 
 	*rx_icm_addr = recalc_cs_ft->rx_icm_addr;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr()
  2026-11-26 13:22 [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr() Wanhui Fu
@ 2026-11-26 13:35 ` sashiko-bot
  2026-11-26 18:35 ` Mark Bloch
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-26 13:35 UTC (permalink / raw)
  To: Wanhui Fu; +Cc: linux-rdma

> If xa_store() fails, the entry recalc_cs_ft has not been stored in
> XArray. Therefore dr_domain_uninit_csum_recalc_fts() would not destroy
> this entry. Just call mlx5dr_fw_destroy_recalc_cs_ft if xa_store() fails.
> 
> Found it by a self-developed static analysis tool and compile-test passed.
> 
> Fixes: c0e90fc2ccaa ("net/mlx5: DR, Support csum recalculation flow table on SFs")
> Signed-off-by: Wanhui Fu <fuwh1120@163.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126132229.4028110-1-fuwh1120@163.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr()
  2026-11-26 13:22 [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr() Wanhui Fu
  2026-11-26 13:35 ` sashiko-bot
@ 2026-11-26 18:35 ` Mark Bloch
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Bloch @ 2026-11-26 18:35 UTC (permalink / raw)
  To: Wanhui Fu, saeedm, leon, tariqt, andrew+netdev, davem, edumazet,
	kuba, pabeni, kliteyn, muhammads
  Cc: netdev, linux-rdma



On 26/11/2026 15:22, Wanhui Fu wrote:
> If xa_store() fails, the entry recalc_cs_ft has not been stored in
> XArray. Therefore dr_domain_uninit_csum_recalc_fts() would not destroy
> this entry. Just call mlx5dr_fw_destroy_recalc_cs_ft if xa_store() fails.
> 
> Found it by a self-developed static analysis tool and compile-test passed.
> 
> Fixes: c0e90fc2ccaa ("net/mlx5: DR, Support csum recalculation flow table on SFs")
> Signed-off-by: Wanhui Fu <fuwh1120@163.com>

Thank you for the fix,

Reviewed-by: Mark Bloch <mbloch@nvidia.com>

> ---
>  .../net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c  | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
> index fedefb565a21..3747c217b61c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/sws/dr_domain.c
> @@ -87,8 +87,10 @@ int mlx5dr_domain_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn,
>  
>  		ret = xa_err(xa_store(&dmn->csum_fts_xa, vport_num,
>  				      recalc_cs_ft, GFP_KERNEL));
> -		if (ret)
> +		if (ret) {
> +			mlx5dr_fw_destroy_recalc_cs_ft(dmn, recalc_cs_ft);
>  			return ret;
> +		}
>  	}
>  
>  	*rx_icm_addr = recalc_cs_ft->rx_icm_addr;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-26 18:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 13:22 [PATCH] net/mlx5: Free the table after storing failure in mlx5dr_domain_get_recalc_cs_ft_addr() Wanhui Fu
2026-11-26 13:35 ` sashiko-bot
2026-11-26 18:35 ` Mark Bloch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox