qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list


From: jerome Arbez-Gindre
Subject: [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list
Date: Wed, 10 Jan 2007 17:34:50 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]