From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id E48E58DA2 for ; Thu, 29 Oct 2015 17:20:37 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 29 Oct 2015 09:20:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,215,1444719600"; d="scan'208";a="590427984" Received: from dwdohert-dpdk-fedora-20.ir.intel.com ([163.33.213.96]) by FMSMGA003.fm.intel.com with ESMTP; 29 Oct 2015 09:20:22 -0700 To: Yaacov Hazan , dev@dpdk.org References: <1445518516-15630-1-git-send-email-yaacovh@mellanox.com> <1445843277-10934-1-git-send-email-yaacovh@mellanox.com> From: Declan Doherty Message-ID: <5632485F.8070104@intel.com> Date: Thu, 29 Oct 2015 16:25:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <1445843277-10934-1-git-send-email-yaacovh@mellanox.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Raslsn Darawsheh Subject: Re: [dpdk-dev] [PATCH v2] net:bonding: fix free_queues function when no queues exist 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: Thu, 29 Oct 2015 16:20:38 -0000 On 26/10/15 07:07, Yaacov Hazan wrote: > From: Raslsn Darawsheh > > In case of creating bond device without add any slaves and > quit from testpmd, application crashed since rx/tx queues > are NULL. > > add checking of this paramters before trying to free. > > Signed-off-by: Raslsn Darawsheh > Signed-off-by: Yaacov Hazan > --- > in previous patch there was mismatch in the solution. > this patch is the correct fix for the described bug > > drivers/net/bonding/rte_eth_bond_pmd.c | 20 ++++++++++++-------- > 1 file changed, 12 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c > index 5cc6372..383fdcf 100644 > --- a/drivers/net/bonding/rte_eth_bond_pmd.c > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c > @@ -1517,17 +1517,21 @@ bond_ethdev_free_queues(struct rte_eth_dev *dev) > { > uint8_t i; > > - for (i = 0; i < dev->data->nb_rx_queues; i++) { > - rte_free(dev->data->rx_queues[i]); > - dev->data->rx_queues[i] = NULL; > + if (dev->data->rx_queues != NULL) { > + for (i = 0; i < dev->data->nb_rx_queues; i++) { > + rte_free(dev->data->rx_queues[i]); > + dev->data->rx_queues[i] = NULL; > + } > + dev->data->nb_rx_queues = 0; > } > - dev->data->nb_rx_queues = 0; > > - for (i = 0; i < dev->data->nb_tx_queues; i++) { > - rte_free(dev->data->tx_queues[i]); > - dev->data->tx_queues[i] = NULL; > + if (dev->data->tx_queues != NULL) { > + for (i = 0; i < dev->data->nb_tx_queues; i++) { > + rte_free(dev->data->tx_queues[i]); > + dev->data->tx_queues[i] = NULL; > + } > + dev->data->nb_tx_queues = 0; > } > - dev->data->nb_tx_queues = 0; > } > > void > Acked-by: Declan Doherty