[libvirt] [PATCH 4/5] Fix incorrect variable passed to LXC event callback

Ryota Ozaki ozaki.ryota at gmail.com
Thu Nov 12 21:01:46 UTC 2009


On Fri, Nov 13, 2009 at 12:00 AM, Daniel P. Berrange
<berrange at redhat.com> wrote:
> The wrong variable was being passed in with the LXC event callback
> resulting in a later deadlock or crash
>
> * src/lxc/lxc_driver.c: Pass 'vm' instead of 'driver' to event
>  callback
> ---
>  src/lxc/lxc_driver.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 2baff65..7c78df2 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -941,7 +941,8 @@ static void lxcMonitorEvent(int watch,
>     }
>
>  cleanup:
> -    virDomainObjUnlock(vm);
> +    if (vm)
> +        virDomainObjUnlock(vm);

Hem, if vm is possible to be NULL, above virDomainObjLock(vm)
likely fails prior to here. So we also need non-NULL check before
virDomainObjLock?

>     if (event) {
>         lxcDriverLock(driver);
>         lxcDomainEventQueue(driver, event);
> @@ -1225,7 +1226,7 @@ static int lxcVmStart(virConnectPtr conn,
>              vm->monitor,
>              VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP,
>              lxcMonitorEvent,
> -             driver, NULL)) < 0) {
> +             vm, NULL)) < 0) {

Oh, horrible ;< ACK to this one anyway.

  ozaki-r

>         lxcVmTerminate(conn, driver, vm, 0);
>         goto cleanup;
>     }
> --
> 1.6.2.5
>
> --
> Libvir-list mailing list
> Libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>




More information about the libvir-list mailing list