diff options
author | Laszlo Ersek <lersek@redhat.com> | 2011-05-25 06:24:25 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-06-01 09:28:20 -0400 |
commit | 6464920a6e30604cb71d0ecbaa20e35009bd76fb (patch) | |
tree | e4b8e6a06c6548d739176988c0bbdc21cafa40eb /drivers/block/xen-blkback | |
parent | 4c49ff3fe128ca68dabd07537415c419ad7f82f9 (diff) |
xen/blkback: don't call vbd_size() if bd_disk is NULL
...because vbd_size() dereferences bd_disk if bd_part is NULL.
Signed-off-by: Laszlo Ersek<lersek@redhat.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback')
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 34570823355b..6cc0db1bf522 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -357,14 +357,13 @@ static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, | |||
357 | } | 357 | } |
358 | 358 | ||
359 | vbd->bdev = bdev; | 359 | vbd->bdev = bdev; |
360 | vbd->size = vbd_sz(vbd); | ||
361 | |||
362 | if (vbd->bdev->bd_disk == NULL) { | 360 | if (vbd->bdev->bd_disk == NULL) { |
363 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", | 361 | DPRINTK("xen_vbd_create: device %08x doesn't exist.\n", |
364 | vbd->pdevice); | 362 | vbd->pdevice); |
365 | xen_vbd_free(vbd); | 363 | xen_vbd_free(vbd); |
366 | return -ENOENT; | 364 | return -ENOENT; |
367 | } | 365 | } |
366 | vbd->size = vbd_sz(vbd); | ||
368 | 367 | ||
369 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) | 368 | if (vbd->bdev->bd_disk->flags & GENHD_FL_CD || cdrom) |
370 | vbd->type |= VDISK_CDROM; | 369 | vbd->type |= VDISK_CDROM; |