From: Liu Yuan Date: Tue, 17 Jun 2014 05:45:35 +0000 (+0800) Subject: sheepdog: fix NULL dereference in sd_create X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5d5da114b39d3cf187a69dcf5eaca7eaf886c041;p=qemu.git 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 Cc: Stefan Hajnoczi Signed-off-by: Liu Yuan Signed-off-by: Stefan Hajnoczi --- diff --git a/block/sheepdog.c b/block/sheepdog.c index 2dcc5959f4..8d9350c26d 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;