Skip to contentSkip to conversation

sheepdog: fix NULL dereference in sd_create

PATCH Applied Liu Yuan 2 participants 2 messages Jun 17, 2014 – Jun 19, 2014 Block layer

lore
Share & tools
lore

Liu Yuan

author
#0 lore raw

PATCH 1/1 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.

---
 block/sheepdog.c | 1 +
 1 file changed, 1 insertion(+)
block/sheepdog.c +1 -0
index 1fa1939..47a8b5a 100644
@@ -1761,6 +1761,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options,
         bdrv_unref(bs);
     }
 
+    s->aio_context = qemu_get_aio_context();
     ret = do_sd_create(s, &vid, 0, errp);
     if (ret) {
         goto out;
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 7 lines · Liu Yuan

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.

Quoted 7 lines
---
 block/sheepdog.c | 1 +
 1 file changed, 1 insertion(+)

Sorry about this, it's my fault.

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan