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

[Xen-devel] [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if b

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH linux-2.6.18-xen] blkback: don't call vbd_size() if bd_disk is NULL
From: Laszlo Ersek <lersek@xxxxxxxxxx>
Date: Wed, 25 May 2011 12:24:25 +0200
Delivery-date: Wed, 25 May 2011 03:24:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10
...because vbd_size() dereferences bd_disk if bd_part is NULL.

Signed-off-by: Laszlo Ersek<lersek@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

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