From eb3b571628a781b9eb5757673dc78b9749a3ffc6 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <68de4f1434a46df7d1b6e59cb348f11c92dbf17c.1380723420.git.minovotn@redhat.com> References: <68de4f1434a46df7d1b6e59cb348f11c92dbf17c.1380723420.git.minovotn@redhat.com> From: Paolo Bonzini Date: Tue, 1 Oct 2013 12:27:09 +0200 Subject: [PATCH 13/13] block/get_block_status: avoid segfault if there is no backing_hd RH-Author: Paolo Bonzini Message-id: <1380630429-29077-9-git-send-email-pbonzini@redhat.com> Patchwork-id: 54623 O-Subject: [RHEL 6.5 qemu-kvm PATCH 8/8] block/get_block_status: avoid segfault if there is no backing_hd Bugzilla: 1010610 RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Eduardo Habkost RH-Acked-by: Jeffrey Cody From: Peter Lieven Reviewed-by: Eric Blake Signed-off-by: Peter Lieven Signed-off-by: Kevin Wolf Signed-off-by: Paolo Bonzini (cherry picked from commit 3e0a233d869e74e78b516be34715b91528508cfc) --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Signed-off-by: Michal Novotny --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 992cc50..6ab6e54 100644 --- a/block.c +++ b/block.c @@ -2790,7 +2790,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.11.7