Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
vfio/pci: Free leaked timer in vfio_realize error path
When vfio_realize fails, the mmap_timer used for INTx optimization
isn't freed. As this timer isn't activated yet, the potential impact
is just a piece of leaked memory.

Fixes: ea48692 ("vfio-pci: Update slow path INTx algorithm timer related")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
  • Loading branch information
duanzhenzhong authored and legoater committed Jun 30, 2023
1 parent 357bd79 commit 0cc889c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hw/vfio/pci.c
Expand Up @@ -3224,6 +3224,9 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
if (vdev->irqchip_change_notifier.notify) {
kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
}
if (vdev->intx.mmap_timer) {
timer_free(vdev->intx.mmap_timer);
}
out_teardown:
vfio_teardown_msi(vdev);
vfio_bars_exit(vdev);
Expand Down

0 comments on commit 0cc889c

Please sign in to comment.