Received: from eggs.gnu.org ([2001:4830:134:3::10]:55611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAFCg-0003v8-F0 for qemu-devel@nongnu.org; Mon, 15 May 2017 08:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAFCf-0002j1-Hz for qemu-devel@nongnu.org; Mon, 15 May 2017 08:34:22 -0400 Date: Mon, 15 May 2017 14:34:08 +0200 From: Kashyap Chamarthy Message-ID: <20170515123408.htpfkq742xmiegem@eukaryote> References: <20170515093424.28954-1-berto@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170515093424.28954-1-berto@igalia.com> Subject: Re: [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: qemu-devel@nongnu.org, Kevin Wolf , qemu-block@nongnu.org, Max Reitz On Mon, May 15, 2017 at 12:34:24PM +0300, Alberto Garcia wrote: > 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(). > > Signed-off-by: Alberto Garcia > --- > block/stream.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/stream.c b/block/stream.c > index 0113710845..52d329f5c6 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); Tested-by: Kashyap Chamarthy Yep, this fixes it. It gracefully throws an error when a 'job-id' was not specified: ----------------------------------------------------------------------- (QEMU) block-stream device=#block890 base=disk1.qcow2 { "execute": "block-stream", "arguments": { "device": "#block890", "base": "disk1.qcow2" } } { "error": { "class": "GenericError", "desc": "An explicit job ID is required for this node" } } (QEMU) block-stream device=#block890 base=disk1.qcow2 job-id=job0 { "execute": "block-stream", "arguments": { "device": "#block890", "job-id": "job0", "base": "disk1.qcow2" } } { "return": {} } (QEMU) ----------------------------------------------------------------------- [...] -- /kashyap