[6943] check for bs->drv in bdrv_flush (Christoph Hellwig)
Revision: 6943
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6943 Author: aliguori Date: 2009-03-29 01:31:51 +0000 (Sun, 29 Mar 2009)
Log Message:
-----------
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 <[email protected]>
Signed-off-by Anthony Liguori <[email protected]>
Modified Paths:
--------------
trunk/block.c
Modified: trunk/block.c
===================================================================
block.c +2 -0
@@ -1002,6 +1002,8 @@void bdrv_flush (BlockDriverState *bs) { +if (!bs->drv) +return ;if (bs->drv->bdrv_flush) bs->drv->bdrv_flush (bs);if (bs->backing_hd)