Commit 2347cee8 authored by Parav Pandit's avatar Parav Pandit Committed by Saeed Mahameed

net/mlx5: Fix rtable reference leak

If the rt entry gateway family is not AF_INET for multipath device,
rtable reference is leaked.
Hence, fix it by releasing the reference.

Fixes: 5fb091e8 ("net/mlx5e: Use hint to resolve route when in HW multipath mode")
Fixes: e32ee6c7 ("net/mlx5e: Support tunnel encap over tagged Ethernet")
Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 64d7b685
...@@ -97,15 +97,19 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv, ...@@ -97,15 +97,19 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
if (ret) if (ret)
return ret; return ret;
if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) {
ip_rt_put(rt);
return -ENETUNREACH; return -ENETUNREACH;
}
#else #else
return -EOPNOTSUPP; return -EOPNOTSUPP;
#endif #endif
ret = get_route_and_out_devs(priv, rt->dst.dev, route_dev, out_dev); ret = get_route_and_out_devs(priv, rt->dst.dev, route_dev, out_dev);
if (ret < 0) if (ret < 0) {
ip_rt_put(rt);
return ret; return ret;
}
if (!(*out_ttl)) if (!(*out_ttl))
*out_ttl = ip4_dst_hoplimit(&rt->dst); *out_ttl = ip4_dst_hoplimit(&rt->dst);
...@@ -149,8 +153,10 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv, ...@@ -149,8 +153,10 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
*out_ttl = ip6_dst_hoplimit(dst); *out_ttl = ip6_dst_hoplimit(dst);
ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev); ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
if (ret < 0) if (ret < 0) {
dst_release(dst);
return ret; return ret;
}
#else #else
return -EOPNOTSUPP; return -EOPNOTSUPP;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment