qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] check for bs->drv in bdrv_flush


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] check for bs->drv in bdrv_flush
Date: Sat, 28 Mar 2009 20:32:35 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

Christoph Hellwig wrote:
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.

Applied.  Thanks.

FWIW, I plan to include qemu-io once you rebase the series to use IOVectors instead of struct iovec. It looks like a useful tool!

Regards,

Anthony Liguori

Signed-off-by: Christoph Hellwig <address@hidden>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c   2009-03-19 21:48:12.180978074 +0100
+++ qemu/block.c        2009-03-19 21:48:53.228977807 +0100
@@ -979,6 +979,8 @@ const char *bdrv_get_device_name(BlockDr
void bdrv_flush(BlockDriverState *bs)
 {
+    if (!bs->drv)
+        return;
     if (bs->drv->bdrv_flush)
         bs->drv->bdrv_flush(bs);
     if (bs->backing_hd)









reply via email to

[Prev in Thread] Current Thread [Next in Thread]