提交 315a1309 编写于 作者: K Kevin Wolf

coroutine: Fix use after free with qemu_coroutine_yield()

Instead of using the same function for entering and exiting coroutines,
and hoping that it doesn't add any functionality that hurts with the
parameters used for exiting, we can just directly call into the real
task switch in qemu_coroutine_switch().

This fixes a use-after-free scenario where reentering a coroutine that
has yielded still accesses the old parent coroutine (which may have
meanwhile terminated) in the part of coroutine_swap() that follows
qemu_coroutine_switch().

Cc: qemu-stable@nongnu.org
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 6608c7e9
......@@ -148,5 +148,5 @@ void coroutine_fn qemu_coroutine_yield(void)
}
self->caller = NULL;
coroutine_swap(self, to);
qemu_coroutine_switch(self, to, COROUTINE_YIELD);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册