On Thu, Feb 17, 2022 at 02:48:56AM -0500, Jagannathan Raman wrote:
> @@ -221,6 +272,14 @@ static void vfu_object_finalize(Object *obj)
>  
>      o->device = NULL;
>  
> +    if (o->unplug_blocker && o->pci_dev) {
> +        qdev_del_unplug_blocker(DEVICE(o->pci_dev), o->unplug_blocker);
> +        error_free(o->unplug_blocker);
> +        o->unplug_blocker = NULL;
> +    }
> +
> +    o->pci_dev = NULL;

Since we don't hold a reference to o->pci_dev there is an assumption
about the order of --object vs --device ->finalize() here. I think it
will work because softmmu/runstate.c:qemu_cleanup() doesn't unref
main_system_bus and only --object ->finalize() is called, but this seems
fragile. We should probably hold a reference to pci_dev and call
object_unref() on it.

Attachment: signature.asc
Description: PGP signature

Reply via email to