From cb57c159b8ffe151ce61750507c635d1d05e51b5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 18 Oct 2013 08:14:50 +0200 Subject: [PATCH 25/81] block/get_block_status: avoid segfault if there is no backing_hd RH-Author: Paolo Bonzini Message-id: <1382084091-16636-26-git-send-email-pbonzini@redhat.com> Patchwork-id: 55008 O-Subject: [RHEL 7.0 qemu-kvm PATCH 25/26] block/get_block_status: avoid segfault if there is no backing_hd Bugzilla: 989646 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Max Reitz RH-Acked-by: Kevin Wolf From: Peter Lieven Reviewed-by: Eric Blake Signed-off-by: Peter Lieven Signed-off-by: Kevin Wolf (cherry picked from commit 1f9db2243c1b987c834fe559a8e73b3178f50c2b) --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Signed-off-by: Miroslav Rezanina --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index 02e111e..5c49461 100644 --- a/block.c +++ b/block.c @@ -3076,7 +3076,7 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs, if (!(ret & BDRV_BLOCK_DATA)) { if (bdrv_has_zero_init(bs)) { ret |= BDRV_BLOCK_ZERO; - } else { + } else if (bs->backing_hd) { BlockDriverState *bs2 = bs->backing_hd; int64_t length2 = bdrv_getlength(bs2); if (length2 >= 0 && sector_num >= (length2 >> BDRV_SECTOR_BITS)) { -- 1.7.1