From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (unknown [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 027EE5A76 for ; Mon, 26 Oct 2015 08:08:39 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yaacovh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 26 Oct 2015 09:08:28 +0200 Received: from r-aa-dragon14.mtr.labs.mlnx (r-aa-dragon14.mtr.labs.mlnx [10.209.68.154]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id t9Q78RJG008130; Mon, 26 Oct 2015 09:08:27 +0200 Received: from r-aa-dragon14.mtr.labs.mlnx (localhost [127.0.0.1]) by r-aa-dragon14.mtr.labs.mlnx (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t9Q78aql011030; Mon, 26 Oct 2015 09:08:36 +0200 Received: (from yaacovh@localhost) by r-aa-dragon14.mtr.labs.mlnx (8.14.4/8.14.4/Submit) id t9Q78YNf011029; Mon, 26 Oct 2015 09:08:34 +0200 From: Yaacov Hazan To: dev@dpdk.org Date: Mon, 26 Oct 2015 09:07:57 +0200 Message-Id: <1445843277-10934-1-git-send-email-yaacovh@mellanox.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445518516-15630-1-git-send-email-yaacovh@mellanox.com> References: <1445518516-15630-1-git-send-email-yaacovh@mellanox.com> Cc: Yaacov Hazan , Raslsn Darawsheh Subject: [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: Mon, 26 Oct 2015 07:08:40 -0000 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 -- 1.9.1