>-----Original Message----- >From: Steve Sistare <steven.sist...@oracle.com> >Subject: [PATCH V4 04/43] vfio/pci: vfio_pci_put_device on failure > >If vfio_realize fails after vfio_device_attach, it should call >vfio_device_detach during error recovery. If it fails after >vfio_device_get_name, it should free vbasedev->name. If it fails >after vfio_pci_config_setup, it should free vdev->msix. > >To fix all, call vfio_pci_put_device(). > >Signed-off-by: Steve Sistare <steven.sist...@oracle.com> >--- > hw/vfio/pci.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c >index a1bfdfe..7d3b9ff 100644 >--- a/hw/vfio/pci.c >+++ b/hw/vfio/pci.c >@@ -3296,6 +3296,7 @@ out_teardown: > vfio_bars_exit(vdev); > error: > error_prepend(errp, VFIO_MSG_PREFIX, vbasedev->name); >+ vfio_pci_put_device(vdev); Double free, vfio_pci_put_device() is also called in vfio_instance_finalize(). Early free of vdev->vbasedev.name will also break something, e.g., trace_vfio_region_finalize(region->vbasedev->name, region->nr); > } > > static void vfio_instance_finalize(Object *obj) >-- >1.8.3.1
- [PATCH V4 35/43] vfio/iommufd: register container for cp... Steve Sistare
- [PATCH V4 01/43] MAINTAINERS: Add reviewer for CPR Steve Sistare
- [PATCH V4 41/43] vfio/iommufd: change process Steve Sistare
- [PATCH V4 32/43] vfio/iommufd: invariant device name Steve Sistare
- [PATCH V4 14/43] vfio/container: recover from unmap-all-... Steve Sistare
- [PATCH V4 40/43] vfio/iommufd: reconstruct hwpt Steve Sistare
- [PATCH V4 24/43] vfio-pci: preserve MSI Steve Sistare
- [PATCH V4 06/43] migration: lower handler priority Steve Sistare
- [PATCH V4 30/43] physmem: qemu_ram_get_fd_offset Steve Sistare
- [PATCH V4 04/43] vfio/pci: vfio_pci_put_device on failur... Steve Sistare
- RE: [PATCH V4 04/43] vfio/pci: vfio_pci_put_device ... Duan, Zhenzhong
- Re: [PATCH V4 04/43] vfio/pci: vfio_pci_put_dev... Steven Sistare
- RE: [PATCH V4 04/43] vfio/pci: vfio_pci_put... Duan, Zhenzhong
- Re: [PATCH V4 04/43] vfio/pci: vfio_pci... Steven Sistare
- RE: [PATCH V4 04/43] vfio/pci: vfi... Duan, Zhenzhong
- Re: [PATCH V4 04/43] vfio/pci:... Steven Sistare
- Re: [PATCH V4 04/43] vfio/pci:... Cédric Le Goater
- [PATCH V4 37/43] vfio/iommufd: cpr state Steve Sistare
- [PATCH V4 42/43] iommufd: preserve DMA mappings Steve Sistare
- [PATCH V4 12/43] vfio/container: restore DMA vaddr Steve Sistare
- Re: [PATCH V4 12/43] vfio/container: restore DMA va... Cédric Le Goater