public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v1] net/mlx5: Fix eswitch offloads cleanup on QoS init failure
@ 2026-04-25  0:29 Prathamesh Deshpande
  0 siblings, 0 replies; only message in thread
From: Prathamesh Deshpande @ 2026-04-25  0:29 UTC (permalink / raw)
  To: saeedm, leon
  Cc: kuba, tariqt, cratiu, cjubran, netdev, linux-rdma, linux-kernel,
	Prathamesh Deshpande

If mlx5_esw_qos_init() fails after esw_offloads_init() succeeds,
mlx5_eswitch_init() jumps to reps_err and skips esw_offloads_cleanup(),
leaking the offloads initialization state.

Add a dedicated unwind label for QoS init failure that cleans up
offloads before continuing the existing vport and outer eswitch cleanup.

Fixes: cac7356c653d ("net/mlx5: Rework esw qos domain init and cleanup")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 123c96716a54..db4bf17d2640 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2059,7 +2059,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
 	esw->mode = MLX5_ESWITCH_LEGACY;
 	err = mlx5_esw_qos_init(esw);
 	if (err)
-		goto reps_err;
+		goto qos_err;
 
 	mutex_init(&esw->offloads.encap_tbl_lock);
 	hash_init(esw->offloads.encap_tbl);
@@ -2088,6 +2088,8 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
 		 MLX5_MAX_MC_PER_VPORT(dev));
 	return 0;
 
+qos_err:
+	esw_offloads_cleanup(esw);
 reps_err:
 	mlx5_esw_vports_cleanup(esw);
 	dev->priv.eswitch = NULL;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-25  0:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-25  0:29 [PATCH net v1] net/mlx5: Fix eswitch offloads cleanup on QoS init failure Prathamesh Deshpande

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