提交 f58a83c2 编写于 作者: I Ido Schimmel 提交者: David S. Miller

mlxsw: spectrum_switchdev: Avoid leaking FID's reference count

It should never be possible for a user to set a VNI on a FID in case one
is already set. The driver therefore returns an error, but fails to drop
the reference count taken earlier when calling
mlxsw_sp_fid_8021d_lookup().

Drop the reference when this unlikely error is hit.

Fixes: 1c30d183 ("mlxsw: spectrum: Enable VxLAN enslavement to bridges")
Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
Reviewed-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 050fc01f
......@@ -2134,8 +2134,10 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
if (!fid)
return -EINVAL;
if (mlxsw_sp_fid_vni_is_set(fid))
return -EINVAL;
if (mlxsw_sp_fid_vni_is_set(fid)) {
err = -EINVAL;
goto err_vni_exists;
}
err = mlxsw_sp_nve_fid_enable(mlxsw_sp, fid, &params, extack);
if (err)
......@@ -2149,6 +2151,7 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
return 0;
err_nve_fid_enable:
err_vni_exists:
mlxsw_sp_fid_put(fid);
return err;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册