From: Liu Yuan <namei.u...@gmail.com> Following command
qemu-img create -f qcow2 sheepdog:test 20g will cause core dump because aio_context is NULL in sd_create. We should initialize it by qemu_get_aio_context() to avoid NULL dereference. Cc: qemu-devel@nongnu.org Cc: Kevin Wolf <kw...@redhat.com> Cc: Stefan Hajnoczi <stefa...@redhat.com> Signed-off-by: Liu Yuan <namei.u...@gmail.com> Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> --- block/sheepdog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/sheepdog.c b/block/sheepdog.c index 2dcc595..8d9350c 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1756,6 +1756,7 @@ static int sd_create(const char *filename, QemuOpts *opts, bdrv_unref(bs); } + s->aio_context = qemu_get_aio_context(); ret = do_sd_create(s, &vid, 0, errp); if (ret) { goto out; -- 1.9.3