qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord l


From: Fabrice Bellard
Subject: Re: [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list
Date: Thu, 11 Jan 2007 20:58:24 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

I think a more complete patch is needed to fully correct the problem.

Regards,

Fabrice.

jerome Arbez-Gindre wrote:
On Thu, 2007-01-11 at 14:56 +0100, jerome Arbez-Gindre wrote:

On Wed, 2007-01-10 at 17:34 +0100, jerome Arbez-Gindre wrote:

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.

I reply to myself because I did not sleep last night:

Here is the fix without the double IOHandlerRecord list iteration.


Here is a little fix to handle the case when a IOHandler removes an
other IOHandler.

--- vl.c.mine   2007-01-11 15:06:47.000000000 +0100
+++ vl.c        2007-01-11 15:27:27.000000000 +0100
@@ -5912,11 +5912,13 @@
         pioh = &first_io_handler ;
         for(ioh = first_io_handler; ioh != NULL; ioh = ioh_next) {
             ioh_next = ioh->next;
-            if (FD_ISSET(ioh->fd, &rfds)) {
+            /* ioh->fd_read could have been set to null by an other
+               IOHandlerRecord callback */
+            if (ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) {
                 ioh->fd_read(ioh->opaque);
             }
             /* ioh->fd_write could have been set to null */
-            if ((ioh->fd_write) && (FD_ISSET(ioh->fd, &wfds))) {
+            if (ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) {
                 ioh->fd_write(ioh->opaque);
             }
             /* the ioh could have been supressed */




_______________________________________________
Qemu-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/qemu-devel







reply via email to

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