|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-changelog
[Xen-changelog] [qemu-xen-unstable] check for bs->drv in bdrv_flush	(Chr
 
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 <=
  
 |  
  
 | 
    | 
  
  
    |   | 
    |