From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8A481A057B; Tue, 7 Apr 2020 13:37:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 714681BEE1; Tue, 7 Apr 2020 13:37:40 +0200 (CEST) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by dpdk.org (Postfix) with ESMTP id 5C5152B96; Tue, 7 Apr 2020 13:37:39 +0200 (CEST) Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 96EFB57E6BF0B5DD1CAB; Tue, 7 Apr 2020 19:37:37 +0800 (CST) Received: from localhost (10.173.251.152) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Apr 2020 19:37:27 +0800 From: wangyunjian To: CC: , , , Yunjian Wang , Date: Tue, 7 Apr 2020 19:37:27 +0800 Message-ID: <1586259447-13508-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.173.251.152] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v1] net/nfp: fix dangling pointer on failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yunjian Wang 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 --- 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