]> Git Repo - qemu.git/commitdiff
sheepdog: Fix crash in co_read_response()
authorKevin Wolf <[email protected]>
Tue, 11 Apr 2017 14:08:53 +0000 (16:08 +0200)
committerPeter Maydell <[email protected]>
Tue, 11 Apr 2017 15:08:29 +0000 (16:08 +0100)
This fixes a regression introduced in commit 9d456654.

aio_co_wake() can only be used to reenter a coroutine that was already
previously entered, otherwise co->ctx is uninitialised and we access
garbage. Using it immediately after qemu_coroutine_create() like in
co_read_response() is wrong and causes segfaults.

Replace the call with aio_co_enter(), which gets an explicit AioContext
parameter and works even for new coroutines.

Signed-off-by: Kevin Wolf <[email protected]>
Tested-by: Kashyap Chamarthy <[email protected]>
Reviewed-by: Max Reitz <[email protected]>
Message-id: 1491919733[email protected]
Signed-off-by: Peter Maydell <[email protected]>
block/sheepdog.c

index 14d63272093524dc224a22507a5620db508dfbdb..fb9203e9be37eaab274d20653d8ce804d036c5b4 100644 (file)
@@ -942,7 +942,7 @@ static void co_read_response(void *opaque)
         s->co_recv = qemu_coroutine_create(aio_read_response, opaque);
     }
 
-    aio_co_wake(s->co_recv);
+    aio_co_enter(s->aio_context, s->co_recv);
 }
 
 static void co_write_request(void *opaque)
This page took 0.030896 seconds and 4 git commands to generate.