[PATCH net-next V2 02/13] net/mlx5: Detach auxiliary devices on attach failure during load
From: Tariq Toukan
Date: Tue Nov 10 2026 - 13:40:40 EST
From: Dragos Tatulea <dtatulea@xxxxxxxxxx>
The device attach phase fails in mlx5_load_one_devl_locked() when
the first device fails to attach. The error path doesn't detach
the remaining devices that successfully attached.
Fix the above condition by properly calling detach on the error
path.
This issue was found during code inspection and was not reproduced.
Hence it doesn't deserve a Fixes tag.
Signed-off-by: Dragos Tatulea <dtatulea@xxxxxxxxxx>
Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
---
drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 1a45474ce03d..7e762f72b19e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -1547,6 +1547,7 @@ int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)
return 0;
err_attach:
+ mlx5_detach_device(dev, true);
clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
mlx5_unload(dev);
err_load:
--
2.44.0