From: Gianni Tedesco Subject: Re: [PATCH]: fix segfault in xl destroy when xenstore has been fowled up Date: Tue, 20 Jul 2010 18:32:30 +0100 Message-ID: <1279647150.1723.1981.camel@qabil.uk.xensource.com> References: <1279641356.1723.1940.camel@qabil.uk.xensource.com> <19525.52837.149559.660268@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <19525.52837.149559.660268@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: Xen Devel , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Oops, forgot signed off by and change subject 8<--------------------- Fix segfault in xl destroy when xenstore has been fowled up libxl_dirname() returns NULL if a string is passed to it which doesn't look like a xenstore key. During xl destroy libxl_dirname is used to generate an xs path in order to remove device backend keys. If a nonsense key has been put in there resulting in NULL backend path this will crash xl. Signed-off-by: diff -r 1eea12f66951 tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Tue Jul 20 17:14:43 2010 +0100 +++ b/tools/libxl/libxl_device.c Tue Jul 20 18:05:19 2010 +0100 @@ -344,7 +344,8 @@ int libxl_devices_destroy(struct libxl_c } for (i = 0; i < n; i++) { flexarray_get(toremove, i, (void**) &path); - xs_rm(clone.xsh, XBT_NULL, path); + if ( path ) + xs_rm(clone.xsh, XBT_NULL, path); } flexarray_free(toremove); libxl_ctx_free(&clone);