qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: jerome Arbez-Gindre <jerome.arbez-gindre@laposte.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list
Date: Wed, 10 Jan 2007 17:34:50 +0100	[thread overview]
Message-ID: <1168446890.24524.11.camel@bibi> (raw)

Hi,

by a call to qemu_set_fd_handler(fd,NULL,NULL,NULL) in the fd_read
callback, I have generated a "Segmentation fault" in vl.c.

My solution is not very smart... but it is very simple.



Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.236
diff -u -r1.236 vl.c
--- vl.c	9 Jan 2007 19:44:41 -0000	1.236
+++ vl.c	10 Jan 2007 16:06:45 -0000
@@ -5926,6 +5926,11 @@
             if (FD_ISSET(ioh->fd, &rfds)) {
                 ioh->fd_read(ioh->opaque);
             }
+        }
+        /* the IOHandlerRecord could have been removed from the list
+           and freed during ioh->fd_read call */
+        for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
+            ioh_next = ioh->next;
             if (FD_ISSET(ioh->fd, &wfds)) {
                 ioh->fd_write(ioh->opaque);
             }

             reply	other threads:[~2007-01-10 16:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-10 16:34 jerome Arbez-Gindre [this message]
2007-01-11 13:56 ` [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list jerome Arbez-Gindre
2007-01-11 15:00   ` jerome Arbez-Gindre
2007-01-11 19:58     ` Fabrice Bellard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1168446890.24524.11.camel@bibi \
    --to=jerome.arbez-gindre@laposte.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).