* [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
@ 2011-05-25 10:24 Laszlo Ersek
2011-05-25 10:36 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2011-05-25 10:24 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
...because vbd_size() dereferences bd_disk if bd_part is NULL.
Signed-off-by: Laszlo Ersek<lersek@redhat.com>
---
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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
2011-05-25 10:24 [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL Laszlo Ersek
@ 2011-05-25 10:36 ` Jan Beulich
2011-05-25 13:01 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2011-05-25 10:36 UTC (permalink / raw)
To: xen-devel@lists.xensource.com, Laszlo Ersek
>>> On 25.05.11 at 12:24, Laszlo Ersek <lersek@redhat.com> wrote:
> ...because vbd_size() dereferences bd_disk if bd_part is NULL.
>
> Signed-off-by: Laszlo Ersek<lersek@redhat.com>
Acked-by: Jan Beulich <jbeulich@novell.com>
> ---
> 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@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
2011-05-25 10:36 ` Jan Beulich
@ 2011-05-25 13:01 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2011-05-25 13:01 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel@lists.xensource.com, Laszlo Ersek
On Wed, May 25, 2011 at 11:36:04AM +0100, Jan Beulich wrote:
> >>> On 25.05.11 at 12:24, Laszlo Ersek <lersek@redhat.com> 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@redhat.com>
>
> Acked-by: Jan Beulich <jbeulich@novell.com>
>
> > ---
> > 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@lists.xensource.com
> > http://lists.xensource.com/xen-devel
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-25 13:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-25 10:24 [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL Laszlo Ersek
2011-05-25 10:36 ` Jan Beulich
2011-05-25 13:01 ` Konrad Rzeszutek Wilk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).