From patchwork Wed Nov 28 09:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 48361 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FA2A1B3FB; Wed, 28 Nov 2018 10:18:10 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1960A5587 for ; Wed, 28 Nov 2018 10:18:08 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 28 Nov 2018 11:23:59 +0200 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wAS9I7vx030834; Wed, 28 Nov 2018 11:18:07 +0200 From: Dekel Peled To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, orika@mellanox.com, dekelp@mellanox.com, nelio.laranjeiro@6wind.com Date: Wed, 28 Nov 2018 11:16:17 +0200 Message-Id: <1543396577-60481-1-git-send-email-dekelp@mellanox.com> X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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@6wind.com Signed-off-by: Dekel Peled --- 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; }