[Devel] [PATCH VZ7] net/mlx5: Fix rtable reference leak

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed May 21 10:39:11 MSK 2025


From: Parav Pandit <parav at mellanox.com>

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: 5fb091e8130b ("net/mlx5e: Use hint to resolve route when in HW multipath mode")
Fixes: e32ee6c78efa ("net/mlx5e: Support tunnel encap over tagged Ethernet")
Signed-off-by: Parav Pandit <parav at mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm at mellanox.com>

(cherry picked from commit 2347cee83b2bd868bde2d283db0fac89f22be4e0)

We see mlx5 modules loaded on the node with leaked rtable-s (with
non-zero refcount), so it is probable that those rtables were leaked
due to known rtable leak in mlx5, let's port the fix.

https://virtuozzo.atlassian.net/browse/ASUP-1514
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
index 60a7527847d6..0edb653ca02a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -72,8 +72,10 @@ static int mlx5e_route_lookup_ipv4(struct mlx5e_priv *priv,
 #endif
 
 	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;
+	}
 
 	if (!(*out_ttl))
 		*out_ttl = ip4_dst_hoplimit(&rt->dst);
@@ -116,8 +118,10 @@ static int mlx5e_route_lookup_ipv6(struct mlx5e_priv *priv,
 		*out_ttl = ip6_dst_hoplimit(dst);
 
 	ret = get_route_and_out_devs(priv, dst->dev, route_dev, out_dev);
-	if (ret < 0)
+	if (ret < 0) {
+		dst_release(dst);
 		return ret;
+	}
 #else
 	return -EOPNOTSUPP;
 #endif
-- 
2.49.0



More information about the Devel mailing list