[libvirt] [PATCH libvirt] libxl: avoid freeing an uninitialised bitmap

Eric Blake eblake at redhat.com
Fri Jun 19 16:54:53 UTC 2015


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 <ian.campbell at citrix.com>
> ---
>  src/libxl/libxl_domain.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150619/d4ebb1f5/attachment-0001.sig>


More information about the libvir-list mailing list