From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H56GA-0007z6-Vi for qemu-devel@nongnu.org; Thu, 11 Jan 2007 15:10:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H56GA-0007yk-DY for qemu-devel@nongnu.org; Thu, 11 Jan 2007 15:10:50 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H56GA-0007yf-BH for qemu-devel@nongnu.org; Thu, 11 Jan 2007 15:10:50 -0500 Received: from [84.96.92.60] (helo=Smtp.neuf.fr) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H56G9-0007nn-Sf for qemu-devel@nongnu.org; Thu, 11 Jan 2007 15:10:50 -0500 Received: from [86.73.70.95] by sp604001mt.gpm.neuf.ld (Sun Java System Messaging Server 6.2-5.05 (built Feb 16 2006)) with ESMTP id <0JBP00CXCZH711V0@sp604001mt.gpm.neuf.ld> for qemu-devel@nongnu.org; Thu, 11 Jan 2007 20:58:19 +0100 (CET) Date: Thu, 11 Jan 2007 20:58:24 +0100 From: Fabrice Bellard Subject: Re: [Qemu-devel] [PATCH] better handling of removal in IOHandlerRecord list In-reply-to: <1168527610.4765.12.camel@bibi> Message-id: <45A696E0.70306@bellard.org> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <1168446890.24524.11.camel@bibi> <1168523801.4765.10.camel@bibi> <1168527610.4765.12.camel@bibi> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > >