cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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