[dpdk-dev] [PATCH] eal: Fix resource leak of pci_uio_map_secondary()
David Marchand
david.marchand at 6wind.com
Wed Jun 15 16:45:25 CEST 2016
Hello Tetsuya,
On Wed, Jun 15, 2016 at 5:26 AM, Tetsuya Mukawa <mukawa at igel.co.jp> wrote:
> If pci_map_resource() succeeds but mapped address is different from an
> address primary process mapped, this should be error.
> Then the address secondary process mapped should be freed.
>
> Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
The title should not contain the function name.
> ---
> lib/librte_eal/common/eal_common_pci_uio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_pci_uio.c b/lib/librte_eal/common/eal_common_pci_uio.c
> index f062e81..e718643 100644
> --- a/lib/librte_eal/common/eal_common_pci_uio.c
> +++ b/lib/librte_eal/common/eal_common_pci_uio.c
> @@ -85,6 +85,9 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
> "Cannot mmap device resource file %s to address: %p\n",
> uio_res->maps[i].path,
> uio_res->maps[i].addr);
> + if (mapaddr != MAP_FAILED)
> + pci_unmap_resource(mapaddr,
> + (size_t)uio_res->maps[i].size);
> return -1;
> }
> }
What of the previous mappings that might have succeeded earlier in this loop ?
--
David Marchand
More information about the dev
mailing list