[dpdk-dev] [PATCH v1] net/nfp: fix dangling pointer on failure
wangyunjian
wangyunjian at huawei.com
Tue Apr 7 13:37:27 CEST 2020
From: Yunjian Wang <wangyunjian at huawei.com>
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 at dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
---
drivers/net/nfp/nfp_net.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 64d9d218d..6e24a09a2 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;
--
2.19.1
More information about the dev
mailing list