Re: [PATCHv2 3/3] util: avoid VM object to be disposed before unlock in close callback.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 01/10/2017 01:23 AM, Wang King wrote:
> Probably causes 'vm' to be disposed in execute qemuProcessAutoDestroy
> callback function, reference 'vm' avoid unlock disposed object.
> 
> Signed-off-by: Wang King <king.wang@xxxxxxxxxx>
> ---
>  src/util/virclosecallbacks.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 

I don't see how getting an extra Ref resolves the issue...

Let's see how 2/3 falls out, but I think this one is dropped.

John
> diff --git a/src/util/virclosecallbacks.c b/src/util/virclosecallbacks.c
> index 633b22c..ab11e95 100644
> --- a/src/util/virclosecallbacks.c
> +++ b/src/util/virclosecallbacks.c
> @@ -337,18 +337,20 @@ virCloseCallbacksRun(virCloseCallbacksPtr closeCallbacks,
>  
>      for (i = 0; i < list->nentries; i++) {
>          virDomainObjPtr vm;
> +        virDomainObjPtr dom;
>  
> -        if (!(vm = virDomainObjListFindByUUID(domains,
> -                                              list->entries[i].uuid))) {
> +        if (!(vm = virDomainObjListFindByUUIDRef(domains,
> +                                                 list->entries[i].uuid))) {
>              char uuidstr[VIR_UUID_STRING_BUFLEN];
>              virUUIDFormat(list->entries[i].uuid, uuidstr);
>              VIR_DEBUG("No domain object with UUID %s", uuidstr);
>              continue;
>          }
>  
> -        vm = list->entries[i].callback(vm, conn, opaque);
> -        if (vm)
> -            virObjectUnlock(vm);
> +        dom = list->entries[i].callback(vm, conn, opaque);
> +        if (dom)
> +            virObjectUnlock(dom);
> +        virObjectUnref(vm);
>      }
>  
>      virObjectLock(closeCallbacks);
> 

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux