[libvirt] [PATCH]: Fix allocation of tapfds when starting qemu

Daniel Veillard veillard at redhat.com
Thu Jun 19 10:26:33 UTC 2008

On Thu, Jun 19, 2008 at 12:06:28PM +0200, Chris Lalancette wrote:
> All,
>      When doing the conversion to danpb's new memory API, a small bug was
> introduced into the qemudNetworkIfaceConnect() function.  In particular, there
> is a call:
>     if (VIR_ALLOC_N(vm->tapfds, vm->ntapfds+2) < 0)
>         goto no_memory;
> However, the tapfds structure is used to track *all* of the tap fds, and is
> called once for each network that is being attached to the domain.  VIR_ALLOC_N
> maps to calloc().  So the first network would work just fine, but if you had
> more than one network, subsequent calls to this function would blow away the
> stored fd's that were already there and fill them all in with zeros.  This
> causes multiple problems, from the qemu domains not starting properly to
> improper cleanup on shutdown.  The attached patch just changes the VIR_ALLOC_N()
> to a VIR_REALLOC_N(), and everything is happy again.
> Signed-off-by: Chris Lalancette <clalance at redhat.com>

  Dohh, okay, +1 please push :-)

   thanks !


Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

More information about the libvir-list mailing list