mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-25 06:27:22 -07:00
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@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6943 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
999dec57f6
commit
081501dace
1 changed files with 2 additions and 0 deletions
2
block.c
2
block.c
|
|
@ -1002,6 +1002,8 @@ const char *bdrv_get_device_name(BlockDriverState *bs)
|
|||
|
||||
void bdrv_flush(BlockDriverState *bs)
|
||||
{
|
||||
if (!bs->drv)
|
||||
return;
|
||||
if (bs->drv->bdrv_flush)
|
||||
bs->drv->bdrv_flush(bs);
|
||||
if (bs->backing_hd)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue