From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] examples/l3fwd: fix validation for queue id of config tuple Date: Mon, 21 Mar 2016 15:12:51 +0100 Message-ID: <1684136.Xd0T4haIcP@xps13> References: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, konstantin.ananyev@intel.com To: Reshma Pattan Return-path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 003ED2E8F for ; Mon, 21 Mar 2016 15:14:29 +0100 (CET) Received: by mail-wm0-f43.google.com with SMTP id l68so153320127wml.0 for ; Mon, 21 Mar 2016 07:14:29 -0700 (PDT) In-Reply-To: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> 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" 2016-03-18 10:35, Reshma Pattan: > 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 Fixes: af75078fece3 ("first public release") > 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 && This check is not really useful if queue_id == queue+1 > + lcore_params[i].queue_id == queue+1) > queue = lcore_params[i].queue_id; > + else if (lcore_params[i].port_id == port && This line repeats the above check. You can nest the "if" instead of "else if". > + 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); > }