[dpdk-dev] [PATCH] eal: Fix resource leak of pci_uio_map_secondary()
Tetsuya Mukawa
mukawa at igel.co.jp
Thu Jun 16 04:03:44 CEST 2016
On 2016/06/15 23:45, David Marchand wrote:
> 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.
Hi David,
Thanks, I will change the title of all patches.
>
>
>> ---
>> 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 ?
I will unmap all addresses mapped before.
Thanks,
Tetsuya
More information about the dev
mailing list