2
0
Эх сурвалжийг харах

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 <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>
Zhenzhong Duan 2 жил өмнө
parent
commit
0cc889c882
1 өөрчлөгдсөн 3 нэмэгдсэн , 0 устгасан
  1. 3 0
      hw/vfio/pci.c

+ 3 - 0
hw/vfio/pci.c

@@ -3224,6 +3224,9 @@ out_deregister:
     if (vdev->irqchip_change_notifier.notify) {
     if (vdev->irqchip_change_notifier.notify) {
         kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
         kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
     }
     }
+    if (vdev->intx.mmap_timer) {
+        timer_free(vdev->intx.mmap_timer);
+    }
 out_teardown:
 out_teardown:
     vfio_teardown_msi(vdev);
     vfio_teardown_msi(vdev);
     vfio_bars_exit(vdev);
     vfio_bars_exit(vdev);