From 8dd569abad0802f2e5adb0a4ac2483a07555ac89 Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Wed, 28 Nov 2018 11:16:17 +0200 Subject: [PATCH] net/mlx5: fix validation of Rx queue number 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: stable@dpdk.org Signed-off-by: Dekel Peled Acked-by: Shahaf Shuler --- 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 97dc3e1f80..ee129b97b4 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -2314,7 +2314,7 @@ mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev, 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; } -- 2.20.1