[libvirt] [PATCH 4/5] Fix incorrect variable passed to LXC event callback
Ryota Ozaki
ozaki.ryota at gmail.com
Fri Nov 13 11:58:49 UTC 2009
On Fri, Nov 13, 2009 at 8:49 PM, Daniel P. Berrange <berrange at redhat.com> wrote:
> On Fri, Nov 13, 2009 at 06:01:46AM +0900, Ryota Ozaki wrote:
>> 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?
>
> No, it is only needed in the cleanup path, due to this bit of code:
>
> if (!vm->persistent) {
> virDomainRemoveInactive(&driver->domains, vm);
> vm = NULL;
> }
>
> cleanup:
> virDomainObjUnlock(vm);
Oh, I missed that... You're right, the fix is correct.
ozaki-r
>
>
> Regards,
> 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 :|
>
More information about the libvir-list
mailing list