From 1cfd511f5d532854018b671d7ba880a41b8fd51c Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 31 May 2017 11:15:11 +0200
Subject: [PATCH 04/13] stream: fix crash in stream_start() when
block_job_create() fails
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1496229312-8649-2-git-send-email-kwolf@redhat.com>
Patchwork-id: 75446
O-Subject: [RHEL-7.4 qemu-kvm-rhev PATCH 1/2] stream: fix crash in stream_start() when block_job_create() fails
Bugzilla: 1456424
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: John Snow <jsnow@redhat.com>
From: Alberto Garcia <berto@igalia.com>
The code that tries to reopen a BlockDriverState in stream_start()
when the creation of a new block job fails crashes because it attempts
to dereference a pointer that is known to be NULL.
This is a regression introduced in a170a91fd3eab6155da39e740381867e,
likely because the code was copied from stream_complete().
Cc: qemu-stable@nongnu.org
Reported-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Alberto Garcia <berto@igalia.com>
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 525989a50a70ea0ffa2b1cdf56279765bb2b7de0)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
block/stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/stream.c b/block/stream.c
index 0113710..52d329f 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -280,6 +280,6 @@ void stream_start(const char *job_id, BlockDriverState *bs,
fail:
if (orig_bs_flags != bdrv_get_flags(bs)) {
- bdrv_reopen(bs, s->bs_flags, NULL);
+ bdrv_reopen(bs, orig_bs_flags, NULL);
}
}
--
1.8.3.1