From patchwork Sat Jan 7 16:40:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naga Harish K, S V" X-Patchwork-Id: 121699 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0C7FEA00C2; Sat, 7 Jan 2023 17:41:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A55B24021D; Sat, 7 Jan 2023 17:41:11 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 9C92540141; Sat, 7 Jan 2023 17:41:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673109669; x=1704645669; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=t9kzC4wjXJy4sIQL8va0wVj68kcAqHN99HelUjYSNQE=; b=fTn+Iy2iZKPfYC1TKzWSZhrZ7+eGlUwuQ+ehMpZcTKizoTT8bQv29T2A C4QyBByVgM/VT8JZQLN3Jjbm5GUZxzrSaN/8Y0peMmWIYSWU18wYA31dv 8C0ZrxsY1Y3CtlN7GhvOaojy1KEjgYsUR5gfLBx8ctJ/5SVRZDlzO+imt u7KfJzUIkdlKz1FIWvEk+mfUwekdR3mgfmnOyrK5UkKhpx1Q5FxPOCoAZ tWAETXO5ekXjLWiBZ938j9ZtDunYpzq60sHW5kjSTrL6dm/5dPMY/uAI/ lqAcloSyTa0YiH/jmkFK+R0s2GxP6Vc8hhxCqY4UFFC5mIXYiBkRjIvYk A==; X-IronPort-AV: E=McAfee;i="6500,9779,10583"; a="387107275" X-IronPort-AV: E=Sophos;i="5.96,308,1665471600"; d="scan'208";a="387107275" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jan 2023 08:41:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10583"; a="763833236" X-IronPort-AV: E=Sophos;i="5.96,308,1665471600"; d="scan'208";a="763833236" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga002.fm.intel.com with ESMTP; 07 Jan 2023 08:41:06 -0800 From: Naga Harish K S V To: jerinj@marvell.com Cc: dev@dpdk.org, jay.jayatheerthan@intel.com, stable@dpdk.org Subject: [PATCH] eventdev/eth_tx: fix service function Date: Sat, 7 Jan 2023 10:40:58 -0600 Message-Id: <20230107164058.3709813-1-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org adapter service function is using RTE_ETH_FOREACH_DEV() macro for looping through all available eth devices and flushing any pending buffered packets. When Traffic Management nodes (vports) are added and deleted dynamically, there is a possibility of accessing the device info memory beyond the allocated limit which can result in segfaults. Fixed the logic to prevent illegal memory access. Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation") Cc: stable@dpdk.org Signed-off-by: Naga Harish K S V --- lib/eventdev/rte_event_eth_tx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eventdev/rte_event_eth_tx_adapter.c b/lib/eventdev/rte_event_eth_tx_adapter.c index 88309d2aaa..ba7a1c7f1b 100644 --- a/lib/eventdev/rte_event_eth_tx_adapter.c +++ b/lib/eventdev/rte_event_eth_tx_adapter.c @@ -676,7 +676,7 @@ txa_service_func(void *args) RTE_ETH_FOREACH_DEV(i) { uint16_t q; - if (i == txa->dev_count) + if (i >= txa->dev_count) break; dev = tdi[i].dev;