Skip to contentSkip to conversation

vfio: fix mem leak when unmapping resource

PATCH David Marchand 1 participant 1 message Jun 29, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

David Marchand

author Reviewed-by
#1 lore raw
Quoted 25 lines · Yunjian Wang

The 'vfio_res' is not freed when unmapping resource by primary process. This leads to memory leak.

Fixes ab53203e194b ("vfio: enable unmapping resource for secondary")
---
 drivers/bus/pci/linux/pci_vfio.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bus/pci/linux/pci_vfio.c +1 -1
index 64cd84a68..bf4c3c1fa 100644
@@ -966,6 +966,7 @@ pci_vfio_unmap_resource_primary(struct rte_pci_device *dev)
        }
 
        TAILQ_REMOVE(vfio_res_list, vfio_res, next);
+       rte_free(vfio_res);
 
        return 0;
 }
--
Quoted 2 lines

2.18.1

Since this element is removed from the shared list, I guess no secondary is using it anymore.

Signature · 1 line
David Marchand