[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools: libxl: do not leak diskpath during local disk attach



Ian Campbell writes ("[PATCH] tools: libxl: do not leak diskpath during local 
disk attach"):
> libxl__device_disk_local_initiate_attach is assigning dls->diskpath with a
> strdup of the device path. This is then passed to the callback, e.g.
> parse_bootloader_result but bootloader_cleanup will not free it.
> 
> Since the callback is within the scope of the (e)gc and therefore doesn't need
> to be malloc'd, a gc'd alloc will do. All other assignments to this field use
> the gc.
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767295
> 
> Reported-by: Gedalya <gedalya@xxxxxxxxxxx>
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

This patch is correct.  Apropos of your question on IRC, it is correct
to use `gc', which is the gc from the ao.  Its lifetime is the whole
device creation operation, which is fine.

You sometimes (including here) don't want to use the egc's gc in an ao
operation, because its lifetime is just the current event callback.
This is why we have STATE_AO_GC at the top of these functions, to make
sure `gc' is simply the right gc.

I will apply this patch to staging and queue it for backport.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.