Skip to contentSkip to conversation

net/mlx5e: Don't leak RSS context in case of error

PATCH Applied Tariq Toukan 2 participants 2 messages May 13 – May 15

Subsystems (5)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx5e: Don't leak RSS context in case of error

From: Gal Pressman <[email protected]>

If mlx5e_rx_res_rss_set_rxfh() fails during mlx5e_create_rxfh_context(), the RSS context is not cleaned up.
This leaves a stale entry in 'res->rss[rss_idx]' that occupies a context slot.

Destroy the RSS context before returning the error.

Fixes 6c2509d44636 ("net/mlx5e: Add error flow for ethtool -X command")
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -1
index bb61e2179078..99a0034b9b20 100644
@@ -1574,8 +1574,11 @@ static int mlx5e_create_rxfh_context(struct net_device *dev,
 					rxfh->indir, rxfh->key,
 					hfunc == ETH_RSS_HASH_NO_CHANGE ? NULL : &hfunc,
 					rxfh->input_xfrm == RXH_XFRM_NO_CHANGE ? NULL : &symmetric);
-	if (err)
+	if (err) {
+		WARN_ON(mlx5e_rx_res_rss_destroy(priv->rx_res,
+						 rxfh->rss_context));
 		goto unlock;
+	}
 
 	mlx5e_rx_res_rss_get_rxfh(priv->rx_res, rxfh->rss_context,
 				  ethtool_rxfh_context_indir(ctx),

base-commit: f5b2772d14884f4be9e718644f1203d4d0e6f0d6

Signature · 1 line
2.44.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Wed, 13 May 2026 09:27:37 +0300 you wrote:

From: Gal Pressman <[email protected]>

If mlx5e_rx_res_rss_set_rxfh() fails during mlx5e_create_rxfh_context(), the RSS context is not cleaned up.
This leaves a stale entry in 'res->rss[rss_idx]' that occupies a context slot.

[...]

Here is the summary with links:
- [net] net/mlx5e: Don't leak RSS context in case of error

    https://git.kernel.org/netdev/net/c/c9d08c8c4c50

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html