[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL



# HG changeset patch
# User Laszlo Ersek <lersek@xxxxxxxxxx>
# Date 1306393744 -3600
# Node ID aedb712c05cf065e943e15d0f38597c2e80f7982
# Parent  e7c536b81b6ae4d61069922d65fe2bf5e2b77d29
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@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---


diff -r e7c536b81b6a -r aedb712c05cf drivers/xen/blkback/vbd.c
--- a/drivers/xen/blkback/vbd.c Thu May 26 08:07:05 2011 +0100
+++ b/drivers/xen/blkback/vbd.c Thu May 26 08:09:04 2011 +0100
@@ -73,7 +73,6 @@
        }
 
        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 @@
                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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.