From: Yunjian Wang Date: Tue, 7 Apr 2020 11:37:27 +0000 (+0800) Subject: net/nfp: fix dangling pointer on probe failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9d5996c01de06fd0c03bc74d58c44f8c29fe7a97;p=dpdk.git net/nfp: fix dangling pointer on probe failure When nfp_pf_create_dev() is cleaning up, it does not correctly set the dev_private variable to NULL, which will lead to a double free. Fixes: ef28aa96e53b ("net/nfp: support multiprocess") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang Acked-by: Heinrich Kuhn --- diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c index bce4d96468..2460ee1992 100644 --- a/drivers/net/nfp/nfp_net.c +++ b/drivers/net/nfp/nfp_net.c @@ -3451,9 +3451,10 @@ nfp_pf_create_dev(struct rte_pci_device *dev, int port, int ports, probe_failed: rte_free(port_name); /* free ports private data if primary process */ - if (rte_eal_process_type() == RTE_PROC_PRIMARY) + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { rte_free(eth_dev->data->dev_private); - + eth_dev->data->dev_private = NULL; + } rte_eth_dev_release_port(eth_dev); return retval;