* [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails
@ 2017-05-15 9:34 Alberto Garcia
2017-05-15 10:12 ` Kevin Wolf
2017-05-15 12:34 ` Kashyap Chamarthy
0 siblings, 2 replies; 3+ messages in thread
From: Alberto Garcia @ 2017-05-15 9:34 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Kevin Wolf, Max Reitz, Alberto Garcia
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 <berto@igalia.com>
---
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);
}
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails
2017-05-15 9:34 [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails Alberto Garcia
@ 2017-05-15 10:12 ` Kevin Wolf
2017-05-15 12:34 ` Kashyap Chamarthy
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2017-05-15 10:12 UTC (permalink / raw)
To: Alberto Garcia; +Cc: qemu-devel, qemu-block, qemu-stable@nongnu.org Max Reitz
Am 15.05.2017 um 11:34 hat Alberto Garcia geschrieben:
> 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 <berto@igalia.com>
Cc: qemu-stable@nongnu.org
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails
2017-05-15 9:34 [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails Alberto Garcia
2017-05-15 10:12 ` Kevin Wolf
@ 2017-05-15 12:34 ` Kashyap Chamarthy
1 sibling, 0 replies; 3+ messages in thread
From: Kashyap Chamarthy @ 2017-05-15 12:34 UTC (permalink / raw)
To: Alberto Garcia; +Cc: qemu-devel, Kevin Wolf, qemu-block, 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 <berto@igalia.com>
> ---
> 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 <kchamart@redhat.com>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-15 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-15 9:34 [Qemu-devel] [PATCH] stream: fix crash in stream_start() when block_job_create() fails Alberto Garcia
2017-05-15 10:12 ` Kevin Wolf
2017-05-15 12:34 ` Kashyap Chamarthy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).