[libvirt] [PATCH 3/4] vbox: change API (un)initialization logic.

Dawid Zamirski dzamirski at datto.com
Tue Oct 11 15:23:13 UTC 2016


On Tue, 2016-10-11 at 16:22 +0200, Martin Kletzander wrote:
> On Wed, Sep 28, 2016 at 01:41:35PM -0400, Dawid Zamirski wrote:
> > 
> > * _pfnUnitilalize decrements connectionCount in g_pVBoxGlobalData
> > and
> >  once it is down to 0, it calls pfnComUnitialize and
> >  g_pVBoxGlobalData if free'd. This ensures that pfnComInitialize
> > and
> >  pfnComUnitialize pair is called only once, even when multiple
> >  concurrent connections are in use.
> 
> That's not true if there is a connection being made while it is being
> free()d or it's being allocated in two threads, etc.  Unless I missed
> something, that is.

On a second thought, seeing how both _pfnInitialize and _pfnUnintialize
(each called in virConnectOpen/Close respectively) obtain a mutex on
g_pVBoxGlobalData, I think my original statement holds true, that is,
ignoring the unsafe allocation of the global as you pointed out
earlier.




More information about the libvir-list mailing list