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 43DADA04E0 for ; Wed, 27 Nov 2019 15:31:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 25F937CBC; Wed, 27 Nov 2019 15:31:40 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 13FDE235; Wed, 27 Nov 2019 15:31:37 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 85DED227E6; Wed, 27 Nov 2019 09:31:36 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 27 Nov 2019 09:31:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=7pOaR1gYi/ j/mrirWVbNpCcPNNRoQlCPjRKLTNrerTM=; b=Rlkb/NvSCXNmd7pTH6GzGEQqAD Pq7GblMBOvvCtDEJi0upOtj2TT6mUPNIqVgy+Hiz3m485PvrOlMTV80SwvtiAUPL 7k6mUrUzsQySYl+Cb8z1p3OQZfYf9dgBccUeHWhX3p13etYgXjru4TA84K5Dd23E MMvwXunYHy1dZwNUs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=7pOaR1gYi/j/mrirWVbNpCcPNNRoQlCPjRKLTNrerTM=; b=tGdNOObS 30r/oHBsl6pJ+iVxtMCRjKr/VJWz3zgmzkSrR3QqaCIiATnrTIU73muoIeDMGIJs 0l+1LDaJXhNpqJL6mJb4Qe01gBrLAGjI2791UwYibEi1LjHhfowhg0opSxgnBBtN tlLuw7D8qfMbUYrvzDVIjgBwyaUaBxe25F+/7fb8FcNw0jo8peY/AJ5aoVS9/EQs andguswLb/O5zgpibIT8FTAjaBoGLK41mtvC/JErLIqots5DBb5psvgIK631ONxq NcMIXCGZK/kMLA+0RT+4T9N3CgIk+JL8ejaPMlcx7+MlNSZDFgqu5LAmGozn+nQD pFvDFLkvuk+teQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeihedgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C83B80065; Wed, 27 Nov 2019 09:31:34 -0500 (EST) From: Thomas Monjalon To: Ferruh Yigit , Andrew Rybchenko Cc: david.marchand@redhat.com, dev@dpdk.org, stable@dpdk.org, Raslan Darawsheh Date: Wed, 27 Nov 2019 15:31:21 +0100 Message-Id: <20191127143121.10590-1-thomas@monjalon.net> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191127134213.9003-1-thomas@monjalon.net> References: <20191127134213.9003-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] ethdev: limit maximum number of queues X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" A buffer overflow happens in testpmd with some drivers since the queue arrays are limited to RTE_MAX_QUEUES_PER_PORT. The advertised capabilities of mlx4, mlx5 and softnic for the number of queues were the maximum number: UINT16_MAX. They must be limited by the configured RTE_MAX_QUEUES_PER_PORT that applications expect to be respected. The limitation is applied at ethdev level (function rte_eth_dev_info_get), in order to force the configured limit for all drivers. Fixes: 14b53e27b30e ("ethdev: fix crash with multiprocess") Cc: stable@dpdk.org Reported-by: Raslan Darawsheh Signed-off-by: Thomas Monjalon Reviewed-by: Ferruh Yigit --- v2: remove changes in drivers, keep limit only in ethdev --- lib/librte_ethdev/rte_ethdev.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8d2ce31a81..6e9cb243ea 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -2986,6 +2986,12 @@ rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info) return eth_err(port_id, diag); } + /* Maximum number of queues should be <= RTE_MAX_QUEUES_PER_PORT */ + dev_info->max_rx_queues = RTE_MIN(dev_info->max_rx_queues, + RTE_MAX_QUEUES_PER_PORT); + dev_info->max_tx_queues = RTE_MIN(dev_info->max_tx_queues, + RTE_MAX_QUEUES_PER_PORT); + dev_info->driver_name = dev->device->driver->name; dev_info->nb_rx_queues = dev->data->nb_rx_queues; dev_info->nb_tx_queues = dev->data->nb_tx_queues; -- 2.23.0