From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=3GGRaHhDOm8sXW4xLlfmHiFY5VcHdwwSJIPr1nbMdnU=; b=we7MX/OIDmgzXAi1L2P9vA+Mc9JCbqslKtRpMdTENaSTO9FiO6p02yYtymO8sND6Dx ompl8CYh6HYlPOjTVc+VpVG4Zoo3/BBeD2JiY97CVh2VO/AhluXdix1z0YYasljwhltW QBoTiXQ4EjlmxxT3yJcCGlBC3rLZBqKx5KfX76YOQTAS9H3dI0awIbncpIz5/D8sp+LY FtBg2AYP6VlMUk5z68OBMOEKFnmYKN7GcTb8H+HaysFgIM+xihkjcF0BQqsEnuy7ZZXw bEScNK+o5AngHVUI313cKQT2ysuZ58ay+1h/+Sqp9CsxbtXbYCMCSzCc0VFA6WMWmpOV GwSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding; bh=3GGRaHhDOm8sXW4xLlfmHiFY5VcHdwwSJIPr1nbMdnU=; b=RScXLq2pXmpZqL9BRvZw3+EpM5yN+X3jSlC3lTH0uozvjamXNkHcy87gyKHfG9U3Xb 3+W9YAu+3MuHslqQCVOPVnwvicjQIbPLVviuUWG0GoGH5QPvSmF1jy9KU23c1oAyw/mg IVMxOczgFhz3N5AkRihj+i4WzLE7NfMJTU6X0mjDdtuTNBp54ysOLuXbxTe3Qyz+cx/T eSwUtbzZoSHRbLBgwU8aIEolAUT4dJNBhs49JNnksCDO6h8HCFpuiGk/ltCysAbLknvC zhosAavRnJzdt4Q0XiBgyhYFIQgcMpT3b+9SyXdW4fycVx7qZxcHKR4r+Z9KCEBinsKE fm3g== X-Gm-Message-State: AD7BkJJwwYZhQeNt6d2JTKlXJTPUI+p4FQfjPx9V/J/HoWYPnmeXAJzGEIO3y3nbvtWCcmh6 X-Received: by 10.28.148.8 with SMTP id w8mr14372581wmd.90.1458569669829; Mon, 21 Mar 2016 07:14:29 -0700 (PDT) Received: from xps13.localnet (91.111.75.86.rev.sfr.net. [86.75.111.91]) by smtp.gmail.com with ESMTPSA id n66sm12735359wmg.20.2016.03.21.07.14.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Mar 2016 07:14:28 -0700 (PDT) From: Thomas Monjalon To: Reshma Pattan Cc: dev@dpdk.org, konstantin.ananyev@intel.com Date: Mon, 21 Mar 2016 15:12:51 +0100 Message-ID: <1684136.Xd0T4haIcP@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> References: <1458297321-25601-1-git-send-email-reshma.pattan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [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: , X-List-Received-Date: Mon, 21 Mar 2016 14:14:30 -0000 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); > }