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

Re: [Xen-devel] [PATCH v2] libxl: fix handling of returns in libxl_get_version_info()



On Fri, Feb 12, 2016 at 6:39 PM, Dario Faggioli
<dario.faggioli@xxxxxxxxxx> wrote:
> On Fri, 2016-02-12 at 12:31 +0000, Wei Liu wrote:
>> On Fri, Feb 12, 2016 at 05:00:40PM +0530, Harmandeep Kaur wrote:
>> >
>> > +    info->xen_version_major = r >> 16;
>> > +    info->xen_version_minor = r & 0xFF;
>> >
>> > -    xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
>> > +    r = xc_version(ctx->xch, XENVER_extraversion, &u.xen_extra);
>> > +    if ( r < 0 ) goto out;
>> >      info->xen_version_extra = libxl__strdup(NOGC, u.xen_extra);
>> >
>> > -    xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
>> > +    r = xc_version(ctx->xch, XENVER_compile_info, &u.xen_cc);
>> > +    if ( r < 0 ) goto out;
>>
>> At the beginning of this function it checks if info-
>> >xen_version_extra
>> is not NULL.
>>
>> You can now get into a state where partial information is cached.
>> This
>> is buggy.
>>
> Yep, I saw this, and figured out it is not ideal. I thought that, as
> you say, original code was bad in this respect already, and that we
> should fix that independently. However...
>
>> Not that the original implementation is any better, but if you're
>> going
>> to fix it, try not to introduce new bug with your fix. :-)
>>
>> I think you can rollback the caching by freeing up any resources
>> before
>> returning.
>>
> ...you're right, it's probably simple enough to fix both issues, that
> we should just take the chance.
>
> So, Harmandeep, can you take care of this issue Wei is rising as well?

Posted v3: 
http://lists.xenproject.org/archives/html/xen-devel/2016-02/msg01891.html

Thanks and Regards.

> Thanks and Regards,
> Dario
> --
> <<This happens because I choose it to happen!>> (Raistlin Majere)
> -----------------------------------------------------------------
> Dario Faggioli, Ph.D, http://about.me/dario.faggioli
> Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.