bonding: fix freeing with no queue

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 parameters before trying to free.

Signed-off-by: Raslsn Darawsheh <rdarawsheh@asaltech.com>
Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
This commit is contained in:
Raslsn Darawsheh 2015-10-26 09:07:57 +02:00 committed by Thomas Monjalon
parent 13634d32ea
commit 32b12e7567

View File

@ -1558,17 +1558,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