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 linux-2.6.18-xen] blkback: don't call vbd_size()

To: Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Wed, 25 May 2011 09:01:50 -0400
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Laszlo Ersek <lersek@xxxxxxxxxx>
Delivery-date: Wed, 25 May 2011 06:03:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4DDCF7B40200007800043721@xxxxxxxxxxxxxxxxxx>
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: <4DDCD8D9.2060404@xxxxxxxxxx> <4DDCF7B40200007800043721@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, May 25, 2011 at 11:36:04AM +0100, Jan Beulich wrote:
> >>> On 25.05.11 at 12:24, Laszlo Ersek <lersek@xxxxxxxxxx> wrote:
> > ...because vbd_size() dereferences bd_disk if bd_part is NULL.

Which would imply that doing this on disk without any partitions would crash.

Weird, I don't seem to get that problem on a disk without any
partitions (just a raw disk). Or does the kernel actually set the
bd_part to something even if it does not have any partitions?

> > 
> > Signed-off-by: Laszlo Ersek<lersek@xxxxxxxxxx>
> 
> Acked-by: Jan Beulich <jbeulich@xxxxxxxxxx>
> 
> > ---
> >   drivers/xen/blkback/vbd.c |    3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff -r 415a9b435fef drivers/xen/blkback/vbd.c
> > --- a/drivers/xen/blkback/vbd.c     Mon May 23 18:36:33 2011 +0100
> > +++ b/drivers/xen/blkback/vbd.c     Wed May 25 12:15:26 2011 +0200
> > @@ -73,7 +73,6 @@ int vbd_create(blkif_t *blkif, blkif_vde
> >     }
> > 
> >     vbd->bdev = bdev;
> > -   vbd->size = vbd_size(vbd);
> > 
> >     if (vbd->bdev->bd_disk == NULL) {
> >             DPRINTK("vbd_creat: device %08x doesn't exist.\n",
> > @@ -82,6 +81,8 @@ int vbd_create(blkif_t *blkif, blkif_vde
> >             return -ENOENT;
> >     }
> > 
> > +   vbd->size = vbd_size(vbd);
> > +
> >     if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom)
> >             vbd->type |= VDISK_CDROM;
> >     if (vbd->bdev->bd_disk->flags & GENHD_FL_REMOVABLE)
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@xxxxxxxxxxxxxxxxxxx 
> > http://lists.xensource.com/xen-devel 
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

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

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