From: Raslsn Darawsheh Date: Mon, 26 Oct 2015 07:07:57 +0000 (+0200) Subject: bonding: fix freeing with no queue X-Git-Tag: spdx-start~8108 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=32b12e75679230b1104b9e6547a1ff3c4a360e05;p=dpdk.git 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 Signed-off-by: Yaacov Hazan Acked-by: Declan Doherty --- diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 500a1eefe9..bbff664bd6 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -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