mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
mlxsw: fix refcount leak in mlxsw_sp_port_lag_join()
When mlxsw_sp_port_lag_index_get() fails, mlxsw_sp_port_lag_join()
returns an error without releasing the lag reference obtained by
the earlier mlxsw_sp_lag_get(). All other error paths in the
function jump to the cleanup label that ends with
mlxsw_sp_lag_put(), so this is a single missed release.
Fix the leak by replacing the bare 'return err' with a goto to the
existing error cleanup label, which will drop the reference safely.
Cc: stable@vger.kernel.org
Fixes: 0d65fc1304 ("mlxsw: spectrum: Implement LAG port join/leave")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260609083709.209743-1-vulab@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e9bcf842b3
commit
41c8c1d65b
|
|
@ -4360,7 +4360,7 @@ static int mlxsw_sp_port_lag_join(struct mlxsw_sp_port *mlxsw_sp_port,
|
|||
lag_id = lag->lag_id;
|
||||
err = mlxsw_sp_port_lag_index_get(mlxsw_sp, lag_id, &port_index);
|
||||
if (err)
|
||||
return err;
|
||||
goto err_lag_uppers_bridge_join;
|
||||
|
||||
err = mlxsw_sp_lag_uppers_bridge_join(mlxsw_sp_port, lag_dev,
|
||||
extack);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user