From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Fehlig Subject: Re: [libvirt] [PATCH libvirt] libxl: avoid freeing an uninitialised bitmap Date: Fri, 19 Jun 2015 13:20:34 -0600 Message-ID: <55846B82.6040107@suse.com> References: <1434731610-25257-1-git-send-email-ian.campbell@citrix.com> <5584495D.9020402@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5584495D.9020402@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Eric Blake , Ian Campbell Cc: libvir-list@redhat.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 06/19/2015 10:54 AM, Eric Blake wrote: > On 06/19/2015 10:33 AM, Ian Campbell wrote: >> If vm->def->cputune.nvcpupin is 0 in libxlDomainSetVcpuAffinities (as >> seems to be the case on arm) then the VIR_FREE after cleanup: would be >> operating on an uninitialised pointer in map.map. >> >> Fix this by using libxl_bitmap_init and libxl_bitmap_dispose in the >> appropriate places (like VIR_FREE libxl_bitmap_dispose is also > s/VIR_FREE/VIR_FREE,/ > >> idempotent, so there is no double free on exit from the loop). >> >> libxl_bitmap_dispose is slightly preferable since it also sets >> map.size back to 0, avoiding a potential source of confusion. >> >> This fixes the crashes we've been seeing in the Xen automated tests on >> ARM. >> >> I had a glance at the handful of other users of libxl_bitmap and none >> of them looked to have a similar issue. >> >> Signed-off-by: Ian Campbell >> --- >> src/libxl/libxl_domain.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) > ACK. Modified the commit message as suggested and pushed. Thanks! Regards, Jim