From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E03F3A04AB; Mon, 11 Nov 2019 15:32:52 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0A3D923D; Mon, 11 Nov 2019 15:32:52 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 9CCB7237 for ; Mon, 11 Nov 2019 15:32:50 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 11 Nov 2019 16:32:45 +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 xABEWjfG027447; Mon, 11 Nov 2019 16:32:45 +0200 From: Dekel Peled To: matan@mellanox.com, shahafs@mellanox.com, viacheslavo@mellanox.com Cc: orika@mellanox.com, dev@dpdk.org, stable@dpdk.org Date: Mon, 11 Nov 2019 16:32:31 +0200 Message-Id: X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix RSS action validation of queue idx 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" RSS action validation function checks the queues included in RSS to make sure they are valid. A Queue is considered valid if the pointer to the queue (item at location queue-index of RxQ array) is not a null value. The queue indices are not checked. If a large value is entered as queue index, using it as an index in RxQ array will result in a pointer to memory out of array bounds. If this memory contains a value which is not null, this queue will be wrongly considered valid. This patch updates function mlx5_flow_validate_action_rss() with check of the input queue indices, as done in function mlx5_flow_validate_action_queue(). Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Cc: stable@dpdk.org Signed-off-by: Dekel Peled --- drivers/net/mlx5/mlx5_flow.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 092f7b4..14a89e2 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1151,6 +1151,11 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, "No queues configured"); for (i = 0; i != rss->queue_num; ++i) { + if (rss->queue[i] >= priv->rxqs_n) + return rte_flow_error_set + (error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + &rss->queue[i], "queue index out of range"); if (!(*priv->rxqs)[rss->queue[i]]) return rte_flow_error_set (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_CONF, -- 1.8.3.1