[libvirt] [PATCH 1/2] qemu: Fix qemuProcessAutoDestroy

John Ferlan posted 2 patches 7 years, 8 months ago
[libvirt] [PATCH 1/2] qemu: Fix qemuProcessAutoDestroy
Posted by John Ferlan 7 years, 8 months ago
Upon entry from virCloseCallbacksRun, the @dom will have a
Ref and Lock from virDomainObjListFindByUUIDRef, so there's
no need to take an extra reference nor should the code call
virDomainObjEndAPI when done since that both Unref's and
Unlock's the @dom which means the callers call to EndAPI
would be unlocking an unlocked object. At least the Ref
saved the code from referencing something already freed.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/qemu/qemu_process.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1afb71f11..14f197e7f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7057,8 +7057,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
 
     VIR_DEBUG("vm=%s, conn=%p", dom->def->name, conn);
 
-    virObjectRef(dom);
-
     if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN)
         stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
 
@@ -7088,7 +7086,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
     qemuDomainEventQueue(driver, event);
 
  cleanup:
-    virDomainObjEndAPI(&dom);
     return dom;
 }
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/2] qemu: Fix qemuProcessAutoDestroy
Posted by Marc Hartmayer 7 years, 8 months ago
On Thu, Mar 29, 2018 at 02:48 PM +0200, John Ferlan <jferlan@redhat.com> wrote:
> Upon entry from virCloseCallbacksRun, the @dom will have a
> Ref and Lock from virDomainObjListFindByUUIDRef, so there's
> no need to take an extra reference nor should the code call
> virDomainObjEndAPI when done since that both Unref's and
> Unlock's the @dom which means the callers call to EndAPI
> would be unlocking an unlocked object. At least the Ref
> saved the code from referencing something already freed.
>
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/qemu/qemu_process.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 1afb71f11..14f197e7f 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -7057,8 +7057,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
>
>      VIR_DEBUG("vm=%s, conn=%p", dom->def->name, conn);
>
> -    virObjectRef(dom);
> -
>      if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN)
>          stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
>
> @@ -7088,7 +7086,6 @@ qemuProcessAutoDestroy(virDomainObjPtr dom,
>      qemuDomainEventQueue(driver, event);
>
>   cleanup:
> -    virDomainObjEndAPI(&dom);
>      return dom;
>  }
>
> --
> 2.13.6
>
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>

Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>

--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list