From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A4F445D04 for ; Thu, 14 Nov 2024 12:56:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BA974025D; Thu, 14 Nov 2024 12:56:00 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id BF7D74025D; Thu, 14 Nov 2024 12:55:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731585359; x=1763121359; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vptSnLNZH2Ar3czMYA3Xs6dmnMtXYLl41Sx9q9liOWs=; b=U/UdwbQuEwlT1b6h9sKYxoymFkwf02XvSMGrBVMcv+gUoVR+we8xP1OS EI63YV/Alw63FJ1Rohnlpa6ZmLLYjYWuNX8hwv93psqLIVN8fvuUKZlnJ DHMEclGC7zaPVFZAMVQlg+QxRoBAl01nnD8lzDvYvJDgTuwjEA5uSVfSL 4xKez0ujLis4k8jxl11BDDlJA8SCaaUKNR0OUcQo1/wXLlT7Gys/waKoZ lB4KB94RKIfTPm2LIWItXxNsMI9M++k5tUZhrMBwFO1qQ+AKk5UMkF4ib E5wBsHT7GvhQa3IosYaZHnb1diwLjI/W9Cugn2IfjHzmFokreEACMIDB5 Q==; X-CSE-ConnectionGUID: CVYP0fEyRqGGIUm9xL/0Fw== X-CSE-MsgGUID: 1wdDugHATKaavnRKCJjr4w== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="48967567" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="48967567" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2024 03:55:58 -0800 X-CSE-ConnectionGUID: UlIS03SHQla8Sbt6ki1pkg== X-CSE-MsgGUID: /bmmNd2MQqeO3g+9MeS9NA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,153,1728975600"; d="scan'208";a="119116296" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa001.fm.intel.com with ESMTP; 14 Nov 2024 03:55:56 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , stable@dpdk.org, Naga Harish K S V , Jerin Jacob , Nikhil Rao Subject: [PATCH] eventdev: fix possible array underflow/overflow Date: Thu, 14 Nov 2024 11:55:38 +0000 Message-ID: <20241114115538.3736059-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 If the number of interrupts is zero, then indexing an array by "nb_rx_intr - 1" will cause an out-of-bounds write Fix this by putting in a check that nb_rx_intr > 0 before doing the array write. Coverity issue: 448870 Fixes: 3810ae435783 ("eventdev: add interrupt driven queues to Rx adapter") Cc: stable@dpdk.org Signed-off-by: Bruce Richardson --- lib/eventdev/rte_event_eth_rx_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 3ee20d95f3..39674c4604 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -2299,7 +2299,7 @@ rxa_sw_add(struct event_eth_rx_adapter *rx_adapter, uint16_t eth_dev_id, for (i = 0; i < dev_info->dev->data->nb_rx_queues; i++) dev_info->intr_queue[i] = i; } else { - if (!rxa_intr_queue(dev_info, rx_queue_id)) + if (!rxa_intr_queue(dev_info, rx_queue_id) && nb_rx_intr > 0) dev_info->intr_queue[nb_rx_intr - 1] = rx_queue_id; } -- 2.43.0