From: Dragos Tatulea 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. Fixes: a925b5e309c9 ("net/mlx5: Register mlx5 devices to auxiliary virtual bus") Signed-off-by: Dragos Tatulea Reviewed-by: Nimrod Oren Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 1 + 1 file changed, 1 insertion(+) V3: - Taken out of a larger series. - Targeted net branch. - Added the Fixes tag (a925b5e309c9) and Reviewed-by from Nimrod Oren. - Pass false instead of true to mlx5_detach_device() in the attach error path. V2: https://lore.kernel.org/all/20261110183826.2927274-3-tariqt@nvidia.com/ diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 0439fcfb9ce5..64ea9f720f2c 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, false); clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); mlx5_unload(dev); err_load: -- 2.44.0