diff options
| author | Shay Drory <shayd@nvidia.com> | 2026-11-09 14:28:45 +0200 |
|---|---|---|
| committer | Leon Romanovsky <leon@kernel.org> | 2026-11-11 08:58:09 -0500 |
| commit | da0c7b9ba5e91b745aeb857be096a60d63c27ec8 (patch) | |
| tree | 6d62079ca0bc62e8d267680245a3af571f3fd589 /kernel/debug | |
| parent | b5c11bf9759834731440806708143c40638dc2ff (diff) | |
RDMA/mlx5: Add missing error flow in mlx5_ib_set_vport_rep
mlx5_ib_set_vport_rep() attaches the representor netdev to the IB
device, which takes a netdev reference, and then adds the LAG demux
rule. If mlx5_lag_demux_rule_add() fails, the error is returned
without detaching the netdev. The eswitch does not call unload() for a
representor whose load() failed, so the reference is never dropped and
a later unregister_netdevice() of the representor waits forever while
holding the eswitch representors lock.
Add the demux rule before publishing the rep and attaching its netdev,
so a failure there leaves nothing to undo. The rep pointers are still
set before ib_device_set_netdev() sends the netdev attach event, so a
listener never sees the attached port without its rep.
If ib_device_set_netdev() fails, delete the demux rule and clear the
rep pointers. ib_device_set_netdev() cannot fail here, as the port
index is always valid and the port data was allocated when the uplink
rep was loaded, so clearing the pointers does not race with lockless
readers.
Fixes: d6c9b4de8109 ("{net/RDMA}/mlx5: Add LAG demux table API and vport demux rules")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Chiara Meiohas <cmeiohas@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
Link: https://patch.msgid.link/20261109-rep-netdev-leak-v2-1-9a6d164142e5@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'kernel/debug')
0 files changed, 0 insertions, 0 deletions
