From: Ian Campbell Subject: Re: xl network-attach SEGV in 4.2 and 4.1 Date: Wed, 17 Apr 2013 09:43:16 +0100 Message-ID: <1366188196.8399.187.camel@zakaz.uk.xensource.com> References: <516E0DCF.9090001@invisiblethingslab.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <516E0DCF.9090001@invisiblethingslab.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Marek Marczykowski Cc: Ian Jackson , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Copying the stable tools maintainer. Please always do so for backport requests (see MAINTAINERS in the relevant tree to see who to copy). On Wed, 2013-04-17 at 03:49 +0100, Marek Marczykowski wrote: > Hi all, > > 4.2 and 4.1 suffers from SEGV during xl network-attach in > libxl__device_nic_add. In 4.3-unstable it is fixed by: > 5420f2650 libxl: Set vfb and vkb devid if not done so by the caller > > So either the patch need to be backported to 4.1 and 4.2, On the face of it I can't see any problem with backporting that commit > or fixed by this one: > ------ > libxl: Fix SEGV in network-attach > > When "device/vif" directory exists but is empty l!=NULL, but nb==0, so > l[nb-1] is invalid. Add missing check. > > Signed-Off-by: Marek Marczykowski > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index 5783cd2..9e06a7d 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -2569,7 +2569,8 @@ void libxl__device_nic_add(libxl__egc *egc, uint32_t > domid, > goto out_free; > } > if (!(l = libxl__xs_directory(gc, XBT_NULL, > - libxl__sprintf(gc, "%s/device/vif", > dompath), &nb))) { > + libxl__sprintf(gc, "%s/device/vif", > dompath), &nb)) || > + nb == 0) { > nic->devid = 0; > } else { > nic->devid = strtoul(l[nb - 1], NULL, 10) + 1; > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel