[dpdk-dev,v2] eal: Fix wrong resource release while unmapping pci devices

Message ID 1466044391-3210-2-git-send-email-mukawa@igel.co.jp (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Commit Message

Tetsuya Mukawa June 16, 2016, 2:33 a.m. UTC
  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 <mukawa@igel.co.jp>
---
 lib/librte_eal/common/eal_common_pci_uio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

David Marchand June 17, 2016, 12:12 p.m. UTC | #1
On Thu, Jun 16, 2016 at 4:33 AM, Tetsuya Mukawa <mukawa@igel.co.jp> wrote:
> 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 <mukawa@igel.co.jp>

Wrong headline uppercase:
    eal: Fix wrong resource release while unmapping pci devices
Wrong headline lowercase:
    eal: Fix wrong resource release while unmapping pci devices
Missing 'Fixes' tag:
    eal: Fix wrong resource release while unmapping pci devices

Then you can add my ack.
  
Thomas Monjalon June 20, 2016, 8:50 a.m. UTC | #2
2016-06-17 14:12, David Marchand:
> On Thu, Jun 16, 2016 at 4:33 AM, Tetsuya Mukawa <mukawa@igel.co.jp> wrote:
> > 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 <mukawa@igel.co.jp>
> 
> Wrong headline uppercase:
>     eal: Fix wrong resource release while unmapping pci devices
> Wrong headline lowercase:
>     eal: Fix wrong resource release while unmapping pci devices
> Missing 'Fixes' tag:
>     eal: Fix wrong resource release while unmapping pci devices
> 
> Then you can add my ack.

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/eal_common_pci_uio.c b/lib/librte_eal/common/eal_common_pci_uio.c
index f062e81..488b6dd 100644
--- a/lib/librte_eal/common/eal_common_pci_uio.c
+++ b/lib/librte_eal/common/eal_common_pci_uio.c
@@ -159,7 +159,9 @@  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);
 	}
 }