]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libxl: avoid freeing an uninitialised bitmap
authorIan Campbell <ian.campbell@citrix.com>
Fri, 19 Jun 2015 16:33:30 +0000 (17:33 +0100)
committerJim Fehlig <jfehlig@suse.com>
Fri, 19 Jun 2015 19:10:45 +0000 (13:10 -0600)
commitcc99d240f5e71209c887f8be7a3561a539704bed
tree20d5a9b6e2ff3a477423e176b0522697f1fe1921
parentee4d2908dd39b882b94eaa056c968d0d4c7f396b
libxl: avoid freeing an uninitialised bitmap

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
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@citrix.com>
src/libxl/libxl_domain.c