WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] qemu-xen: fix segfault with empty cdroms

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] qemu-xen: fix segfault with empty cdroms
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 11 Feb 2011 17:47:59 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Fri, 11 Feb 2011 09:48:47 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19797.30125.552075.628420@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1102111230350.2826@kaball-desktop> <19797.30125.552075.628420@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Fri, 11 Feb 2011, Ian Jackson wrote:
> Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix segfault with 
> empty cdroms"):
> > When the cdrom is empty the params node in xenstore might be missing
> > completely, cope with it instead of segfaulting.
> ...
> >     blkdev->params = xenstore_read_be_str(&blkdev->xendev, "params");
> > -        h = strchr(blkdev->params, ':');
> > +        if (blkdev->params != NULL)
> > +            h = strchr(blkdev->params, ':');
> 
> So blkdev->params may be 0.  In that case, we end up with:
> 
>               blkdev->fileproto = "<unset>";
>               blkdev->filename  = blkdev->params;
> 
> so now ->filename may be 0.  Eventually,
> 
>               if (bdrv_open2(blkdev->bs, blkdev->filename, qflags,
>                              bdrv_find_format(blkdev->fileproto)) != 0) {
> 
> Isn't that going to crash ?
> 
> Perhaps a clause needs to be added to:
> 
>       /* do we have all we need? */
>       if (blkdev->params == NULL ||
>           blkdev->mode == NULL   ||
>           blkdev->type == NULL   ||
>           blkdev->dev == NULL)
>           return -1;
 

No need, in fact if blkdev->params is NULL we return -1 right here.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>