[dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number

Dekel Peled dekelp at mellanox.com
Wed Nov 28 10:16:17 CET 2018


Function mlx5_ctrl_flow_vlan() is used to set the rss rule in
MLX5 PMD, using priv->reta_idx_n as number of Rx queues.
This number is passed to mlx5_flow_validate_action_rss(), which
attempts to access the Rx queues at priv->rxqs.
In case priv->rxqs_n is 0, priv->rxqs is empty, and
mlx5_flow_validate_action_rss() will crash with segmentation fault.

priv->reta_idx_n can never be 0, even if priv->rxqs_n is set to 0.
But when priv->rxqs_n is set to 0, setting the rss rule is invalid.

This patch updates mlx5_ctrl_flow_vlan(), if priv->rxqs_n is 0 the
function will fail with EINVAL errno.

Fixes: 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
Cc: nelio.laranjeiro at 6wind.com

Signed-off-by: Dekel Peled <dekelp at mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 97dc3e1..ee129b9 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2314,7 +2314,7 @@ struct rte_flow *
 	struct rte_flow_error error;
 	unsigned int i;
 
-	if (!priv->reta_idx_n) {
+	if (!priv->reta_idx_n || !priv->rxqs_n) {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-- 
1.8.3.1



More information about the dev mailing list