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

Re: [libvirt] [PATCH] Fix remote driver crash



On Tue, Jan 20, 2009 at 05:36:46PM -0800, john levon sun com wrote:
> # HG changeset patch
> # User john levon sun com
> # Date 1232501231 28800
> # Node ID 12e2e9f6eb99f86c2ab20f1e6a7b7a77418e66db
> # Parent  39479c2678f822349169112e31e6061af3289548
> Fix remote driver crash
> 
> Ensure ->watch is initialized so it's not used before an
> updateHandleImpl is registered.
> 
> Signed-off-by: John Levon <john levon sun com>
> 
> diff --git a/src/remote_internal.c b/src/remote_internal.c
> --- a/src/remote_internal.c
> +++ b/src/remote_internal.c
> @@ -902,7 +902,9 @@ remoteOpen (virConnectPtr conn,
>  #endif
>      }
>  
> +    priv->watch = -1;
>      priv->sock = -1;
> +
>      ret = doRemoteOpen(conn, priv, auth, rflags);
>      if (ret != VIR_DRV_OPEN_SUCCESS) {
>          conn->privateData = NULL;

This is already initialized earlier on in the remoteOpen() method
so I don't think this chunk could have be the cause of the crashes.

    if (VIR_ALLOC(priv) < 0) {
        error (conn, VIR_ERR_NO_MEMORY, _("struct private_data"));
        return VIR_DRV_OPEN_ERROR;
    }

    if (virMutexInit(&priv->lock) < 0) {
        error(conn, VIR_ERR_INTERNAL_ERROR,
              _("cannot initialize mutex"));
        VIR_FREE(priv);
        return VIR_DRV_OPEN_ERROR;
    }
    remoteDriverLock(priv);
    priv->localUses = 1;
    priv->watch = -1;



The remoteNetworkOpen, remoteStorageOpen and remoteDevMonOpen methods 
have scenarios where we'd miss the initialization, and thus need a patch.
But since you have adapted the Xen driver to always go via libvirtd, you 
shouldn't hit those scenarios either.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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