From: Zhenzhong Duan Date: Thu, 29 Jun 2023 08:40:39 +0000 (+0800) Subject: vfio/pci: Free leaked timer in vfio_realize error path X-Git-Tag: pull-xen-20230801~55^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0cc889c8826cefa5b80110d31a62273b56aa1832;p=people%2Faperard%2Fqemu-dm.git 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: ea486926b07d ("vfio-pci: Update slow path INTx algorithm timer related") Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Joao Martins Signed-off-by: Cédric Le Goater --- diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 48df517f79..ab6645ba60 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3224,6 +3224,9 @@ out_deregister: 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);