[dpdk-dev] net:bonding: fix free_queues function when no queues exist

Message ID 1445518516-15630-1-git-send-email-yaacovh@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Yaacov Hazan Oct. 22, 2015, 12:55 p.m. UTC
  From: Raslsn Darawsheh <rdarawsheh@asaltech.com>

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 <rdarawsheh@asaltech.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 5cc6372..40b63d7 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1518,12 +1518,18 @@  bond_ethdev_free_queues(struct rte_eth_dev *dev)
 	uint8_t i;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
+		if (dev->data->rx_queues[i] == NULL)
+			continue;
+
 		rte_free(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
 	}
 	dev->data->nb_rx_queues = 0;
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
+		if (dev->data->tx_queues[i] == NULL)
+			continue;
+
 		rte_free(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
 	}