From patchwork Fri Mar 18 10:35:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pattan, Reshma" X-Patchwork-Id: 11584 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 D2F0F5685; Fri, 18 Mar 2016 11:35:27 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id C5AF15590 for ; Fri, 18 Mar 2016 11:35:25 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 18 Mar 2016 03:35:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,354,1455004800"; d="scan'208";a="68904934" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga004.fm.intel.com with ESMTP; 18 Mar 2016 03:35:23 -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 u2IAZMeA018244; Fri, 18 Mar 2016 10:35:23 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u2IAZMBg025695; Fri, 18 Mar 2016 10:35:22 GMT Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u2IAZM2S025691; Fri, 18 Mar 2016 10:35:22 GMT From: Reshma Pattan To: dev@dpdk.org, konstantin.ananyev@intel.com Cc: Reshma Pattan Date: Fri, 18 Mar 2016 10:35:21 +0000 Message-Id: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] 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: Commit af75078f Signed-off-by: Reshma Pattan --- examples/l3fwd/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 0e33039..f148d4e 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -264,8 +264,14 @@ get_port_n_rx_queues(const uint8_t port) for (i = 0; i < nb_lcore_params; ++i) { if (lcore_params[i].port_id == port && - lcore_params[i].queue_id > queue) + lcore_params[i].queue_id > queue && + lcore_params[i].queue_id == queue+1) queue = lcore_params[i].queue_id; + else if (lcore_params[i].port_id == port && + lcore_params[i].queue_id != queue+1) + 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); }