]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/mlx5e: SD, Fix missing cleanup on probe error
authorShay Drory <shayd@nvidia.com>
Mon, 4 May 2026 18:02:05 +0000 (21:02 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 6 May 2026 02:13:09 +0000 (19:13 -0700)
commit3564222cfdde83a2d760b80192155a3ada1c9bdd
tree23bff06c8d92823b2cdc465ede49318c7e1843c2
parent05217e4ffbb229e7218cf318e0033780abadb624
net/mlx5e: SD, Fix missing cleanup on probe error

When _mlx5e_probe() fails, the preceding successful mlx5_sd_init() is
not undone. Auxiliary bus probe failure skips binding, so mlx5e_remove()
is never called for that adev and the matching mlx5_sd_cleanup() never
runs - leaking the per-dev SD struct.

Call mlx5_sd_cleanup() on the probe error path to balance
mlx5_sd_init().

A similar gap exists on the resume path: mlx5_sd_init() and
mlx5_sd_cleanup() are currently bundled with both probe/remove and
suspend/resume, even though only the FW alias state actually needs to
follow the suspend/resume lifecycle - the sd struct allocation and
devcom membership are software state that should track the full bound
lifetime. As a result, a failed resume can leave a still-bound device
with sd == NULL, which mlx5_sd_get_adev() can't distinguish from a
non-SD device. Fixing this requires sd_suspend/resume APIs which will
only destroy FW resources and is left for a follow-up series.

Fixes: 381978d28317 ("net/mlx5e: Create single netdev per SD group")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260504180206.268568-4-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c