[dpdk-dev] [PATCH 1/1] bonding: fix error handling in rte_eth_bond_create()

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Aug 4 17:52:51 CEST 2015


2015-08-04 16:26, Bernard Iremonger:
> if the name parameter to rte_eth_bond_create() was NULL,
> there was a segmentation fault.

What is the root cause of the crash?
I guess it is rte_free(eth_dev->data->mac_addrs) because eth_dev is NULL.

[...]
> -err:
> -	rte_free(pci_dev);
> -	rte_free(internals);
> +err4:
>  	rte_free(eth_dev->data->mac_addrs);
> -
> +err3:
> +	rte_free(internals);
> +err2:
> +	rte_free(pci_dev);
> +err1:
>  	return -1;
>  }

rte_free should be harmless with NULL parameter.
It is easier to add "if (eth_dev != NULL)" than maintaining many error labels.

By the way, why rte_eth_dev_release_port() is not called?



More information about the dev mailing list