提交 5d5da114 编写于 作者: L Liu Yuan 提交者: Stefan Hajnoczi

sheepdog: fix NULL dereference in sd_create

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 <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NLiu Yuan <namei.unix@gmail.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 435db4cf
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册