From patchwork Thu Mar 24 23:11:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 11705 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 68C072BF2; Fri, 25 Mar 2016 00:11:23 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 3E0592BE6 for ; Fri, 25 Mar 2016 00:11:21 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 24 Mar 2016 16:11:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,387,1455004800"; d="scan'208";a="770962083" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2016 16:11:05 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u2ONB4QV014638; Thu, 24 Mar 2016 23:11:04 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u2ONB44J011248; Thu, 24 Mar 2016 23:11:04 GMT Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u2ONB4Dq011244; Thu, 24 Mar 2016 23:11:04 GMT From: Reshma Pattan To: dev@dpdk.org, konstantin.ananyev@intel.com Cc: Reshma Pattan Date: Thu, 24 Mar 2016 23:11:01 +0000 Message-Id: <1458861061-11211-1-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> References: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v2] examples/l3fwd: fix validation for queue id of config tuple X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Added validation for queue id of config parameter tuple. This validation enforces user to enter queue ids of a port from 0 and in sequence. This additional validation on queue ids avoids ixgbe crash caused by null rxq pointer access inside ixgbe_dev_rx_init. Reason for null rxq is, L3fwd application allocates memory only for queues passed by user. But rte_eth_dev_start tries to initialize rx queues in sequence from 0 to nb_rx_queues, which is not true and coredump while accessing the unallocated queue . Signed-off-by: Reshma Pattan --- v2: used nested if instead of if and elseif. examples/l3fwd/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 792894f..f297177 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -263,9 +263,14 @@ get_port_n_rx_queues(const uint8_t port) uint16_t i; for (i = 0; i < nb_lcore_params; ++i) { - if (lcore_params[i].port_id == port && - lcore_params[i].queue_id > queue) - queue = lcore_params[i].queue_id; + if (lcore_params[i].port_id == port) { + if (lcore_params[i].queue_id == queue+1) + queue = lcore_params[i].queue_id; + else + rte_exit(EXIT_FAILURE, "queue ids of the port %d must be" + " in sequence and must start with 0", + lcore_params[i].port_id); + } } return (uint8_t)(++queue); }