* [Qemu-devel] [PATCH] Allow nested qemu_bh_poll() after BH deletion
@ 2011-06-15 10:33 Kevin Wolf
2011-06-15 12:04 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2011-06-15 10:33 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
Without this, qemu segfaults when a BH handler first deletes its BH and
then calls another function which involves a nested qemu_bh_poll() call.
This can be reproduced by generating an I/O error (e.g. with blkdebug) on
an IDE device and using rerror/werror=stop to stop the VM. When continuing
the VM, qemu segfaults.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
async.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/async.c b/async.c
index 57ac3a8..fd313df 100644
--- a/async.c
+++ b/async.c
@@ -137,11 +137,12 @@ QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque)
int qemu_bh_poll(void)
{
- QEMUBH *bh, **bhp;
+ QEMUBH *bh, **bhp, *next;
int ret;
ret = 0;
- for (bh = async_context->first_bh; bh; bh = bh->next) {
+ for (bh = async_context->first_bh; bh; bh = next) {
+ next = bh->next;
if (!bh->deleted && bh->scheduled) {
bh->scheduled = 0;
if (!bh->idle)
--
1.7.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Allow nested qemu_bh_poll() after BH deletion
2011-06-15 10:33 [Qemu-devel] [PATCH] Allow nested qemu_bh_poll() after BH deletion Kevin Wolf
@ 2011-06-15 12:04 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-06-15 12:04 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel
On Wed, Jun 15, 2011 at 11:33 AM, Kevin Wolf <kwolf@redhat.com> wrote:
> Without this, qemu segfaults when a BH handler first deletes its BH and
> then calls another function which involves a nested qemu_bh_poll() call.
>
> This can be reproduced by generating an I/O error (e.g. with blkdebug) on
> an IDE device and using rerror/werror=stop to stop the VM. When continuing
> the VM, qemu segfaults.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> async.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
Almost worth switching to qemu-queue.h and FOREACH_SAFE().
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-06-15 12:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 10:33 [Qemu-devel] [PATCH] Allow nested qemu_bh_poll() after BH deletion Kevin Wolf
2011-06-15 12:04 ` 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).