libxl: avoid freeing an uninitialised bitmap
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Ian Campbell
If
vm->def->cputune.nvcpupinis 0 in libxlDomainSetVcpuAffinities (as seems to be the case on arm) then theVIR_FREEafter cleanup: would be operating on an uninitialised pointer in map.map.Fix this by using
libxl_bitmap_initandlibxl_bitmap_disposein the appropriate places (likeVIR_FREElibxl_bitmap_disposeis also
s/VIR_FREE/VIR_FREE,/
Quoted 8 lines
idempotent, so there is no double free on exit from the loop).
libxl_bitmap_disposeis 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.
Quoted 7 lines
I had a glance at the handful of other users of
libxl_bitmapand none of them looked to have a similar issue.Signed-off-by Ian Campbell <[email protected]>--- src/libxl/libxl_domain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
ACK.
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · Eric Blake
Quoted 6 lines · Ian Campbell
If
vm->def->cputune.nvcpupinis 0 in libxlDomainSetVcpuAffinities (as seems to be the case on arm) then theVIR_FREEafter cleanup: would be operating on an uninitialised pointer in map.map.Fix this by using
libxl_bitmap_initandlibxl_bitmap_disposein the appropriate places (likeVIR_FREElibxl_bitmap_disposeis alsos/VIR_FREE/VIR_FREE,/
Quoted 8 lines
idempotent, so there is no double free on exit from the loop).
libxl_bitmap_disposeis 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.
Quoted 8 lines
Quoted 7 lines
I had a glance at the handful of other users of
libxl_bitmapand none of them looked to have a similar issue.Signed-off-by Ian Campbell <[email protected]>--- 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