Commit 5d5da114 authored by Liu Yuan's avatar Liu Yuan Committed by Stefan Hajnoczi
Browse files

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: default avatarLiu Yuan <namei.unix@gmail.com>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 435db4cf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;