From 3f0339efc1ffa171ddcea94ed4c5c113635d5545 Mon Sep 17 00:00:00 2001 From: Tetsuya Mukawa Date: Thu, 16 Jun 2016 11:33:10 +0900 Subject: [PATCH] pci: fix resource release when unmapping This patch fixes wrong resource release of pci_uio_unmap(). The 'path' member of mapped_pci_resource structure is allocated by primary process, but currently it will be freed by both primary and secondary process. The patch fixes to be freed by only primary process. Signed-off-by: Tetsuya Mukawa Acked-by: David Marchand --- lib/librte_eal/common/eal_common_pci_uio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_pci_uio.c b/lib/librte_eal/common/eal_common_pci_uio.c index 70c6155812..367a6816dc 100644 --- a/lib/librte_eal/common/eal_common_pci_uio.c +++ b/lib/librte_eal/common/eal_common_pci_uio.c @@ -169,7 +169,8 @@ pci_uio_unmap(struct mapped_pci_resource *uio_res) for (i = 0; i != uio_res->nb_maps; i++) { pci_unmap_resource(uio_res->maps[i].addr, (size_t)uio_res->maps[i].size); - rte_free(uio_res->maps[i].path); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + rte_free(uio_res->maps[i].path); } } -- 2.20.1