Blame SOURCES/kvm-block-get_block_status-avoid-segfault-if-there-is-no.patch

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