All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net V3] net/mlx5: Detach auxiliary devices on attach failure during load
@ 2026-12-02 12:24 Tariq Toukan
  2026-12-02 12:28 ` netdev-bot+sinfo
  2026-12-02 12:31 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-12-02 12:24 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn
  Cc: Dragos Tatulea, Gal Pressman, Leon Romanovsky, linux-rdma,
	Mark Bloch, Nimrod Oren, Saeed Mahameed, Tariq Toukan

From: Dragos Tatulea <dtatulea@nvidia.com>

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 <dtatulea@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 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


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

end of thread, other threads:[~2026-12-02 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:24 [PATCH net V3] net/mlx5: Detach auxiliary devices on attach failure during load Tariq Toukan
2026-12-02 12:28 ` netdev-bot+sinfo
2026-12-02 12:31 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.