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-changelog

[Xen-changelog] [qemu-xen-unstable] check for bs->drv in bdrv_flush (Chr

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] check for bs->drv in bdrv_flush (Christoph Hellwig)
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Wed, 7 Oct 2009 08:36:29 -0700
Delivery-date: Wed, 07 Oct 2009 08:36:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
commit dddf85563a18db9ae83d59ad567f4d77d39da821
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Wed Oct 7 15:51:55 2009 +0100

    check for bs->drv in bdrv_flush (Christoph Hellwig)
    
    All the bdrv_ helpers should check for bs->drv being zero as that means
    there is no backend image open.  bdrv_flush fails to perform that check
    and can thus cause NULL pointer dereferences.
    
    Found using qemu-io.
    
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
    
    git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6943 
c046a42c-6fe2-441c-8c8c-71466251a162
    
    [ Backported from 6bbff9a0b495918309074ac60375be5f9dc868b3
      by Stefano Stabellini. ]
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 block.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/block.c b/block.c
index c3c44a9..3261225 100644
--- a/block.c
+++ b/block.c
@@ -1071,6 +1071,8 @@ const char *bdrv_get_device_name(BlockDriverState *bs)
 int bdrv_flush(BlockDriverState *bs)
 {
     int ret = 0;
+    if (!bs->drv)
+        return -EINVAL;
     if (bs->drv->bdrv_flush)
         ret = bs->drv->bdrv_flush(bs);
     if (!ret && bs->backing_hd)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] check for bs->drv in bdrv_flush (Christoph Hellwig), Ian Jackson <=