From patchwork Fri Mar 25 15:13:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 11731 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 B58575587; Fri, 25 Mar 2016 16:36:41 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 39DCA376E for ; Fri, 25 Mar 2016 16:36:40 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 25 Mar 2016 08:36:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,391,1455004800"; d="scan'208";a="918733192" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 25 Mar 2016 08:36:38 -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 u2PFDjXm024220; Fri, 25 Mar 2016 15:13:46 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u2PFDj32015206; Fri, 25 Mar 2016 15:13:45 GMT Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u2PFDjVg015201; Fri, 25 Mar 2016 15:13:45 GMT From: Reshma Pattan To: dev@dpdk.org, konstantin.ananyev@intel.com Cc: Reshma Pattan Date: Fri, 25 Mar 2016 15:13:44 +0000 Message-Id: <1458918824-15168-1-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1458861061-11211-1-git-send-email-reshma.pattan@intel.com> References: <1458861061-11211-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v3] 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 . Fixes: af75078fece3 ("first public release") Signed-off-by: Reshma Pattan Acked-by: Pablo de Lara --- v3: added Fixes line added "\n" at the end of err message. v2: used nested if instead of if and elseif. examples/l3fwd/main.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 792894f..97a1423 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\n", + lcore_params[i].port_id); + } } return (uint8_t)(++queue); }