qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sheepdog: fix NULL dereference in sd_create
@ 2014-06-17  5:45 Liu Yuan
  2014-06-19  9:43 ` Stefan Hajnoczi
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Yuan @ 2014-06-17  5:45 UTC (permalink / raw)
  To: sheepdog; +Cc: Kevin Wolf, qemu-devel, Stefan Hajnoczi

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: Liu Yuan <namei.unix@gmail.com>
---
 block/sheepdog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 1fa1939..47a8b5a 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -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;
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] sheepdog: fix NULL dereference in sd_create
  2014-06-17  5:45 [Qemu-devel] [PATCH] sheepdog: fix NULL dereference in sd_create Liu Yuan
@ 2014-06-19  9:43 ` Stefan Hajnoczi
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2014-06-19  9:43 UTC (permalink / raw)
  To: Liu Yuan; +Cc: Kevin Wolf, sheepdog, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

On Tue, Jun 17, 2014 at 01:45:35PM +0800, Liu Yuan wrote:
> 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: Liu Yuan <namei.unix@gmail.com>
> ---
>  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

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-19  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17  5:45 [Qemu-devel] [PATCH] sheepdog: fix NULL dereference in sd_create Liu Yuan
2014-06-19  9:43 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).