From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1JFcU1-00017v-DF for user-mode-linux-devel@lists.sourceforge.net; Thu, 17 Jan 2008 13:41:09 -0800 Received: from saraswathi.solana.com ([198.99.130.12]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1JFcU0-0001lU-Pq for user-mode-linux-devel@lists.sourceforge.net; Thu, 17 Jan 2008 13:41:09 -0800 Date: Thu, 17 Jan 2008 16:40:46 -0500 From: Jeff Dike Message-ID: <20080117214046.GA6762@c2.user-mode-linux.org> Mime-Version: 1.0 Content-Disposition: inline Subject: [uml-devel] [PATCH 15/20] UML - Fix infinite mconsole loop List-Id: The user-mode Linux development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: user-mode-linux-devel-bounces@lists.sourceforge.net Errors-To: user-mode-linux-devel-bounces@lists.sourceforge.net To: Andrew Morton Cc: LKML , uml-devel , Karol Swietlicki From: Karol Swietlicki This patch takes care of a problem with the stopping code. The function inside the while condition returns 0 to signify a problem. A problem could be for example a bad command or a bad version of the mconsole client. A bad command would terminate the stopping loop and resume the kernel. This is a problem. A better solution is to make the loop infinite and don't leave it until we are explicitly told to. Signed-off-by: Karol Swietlicki Signed-off-by: Jeff Dike --- arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-2.6.22/arch/um/drivers/mconsole_kern.c =================================================================== --- linux-2.6.22.orig/arch/um/drivers/mconsole_kern.c 2007-12-12 13:44:20.000000000 -0500 +++ linux-2.6.22/arch/um/drivers/mconsole_kern.c 2007-12-12 15:53:08.000000000 -0500 @@ -305,7 +305,9 @@ void mconsole_stop(struct mc_request *re deactivate_fd(req->originating_fd, MCONSOLE_IRQ); os_set_fd_block(req->originating_fd, 1); mconsole_reply(req, "stopped", 0, 0); - while (mconsole_get_request(req->originating_fd, req)) { + for (;;) { + if (!mconsole_get_request(req->originating_fd, req)) + continue; if (req->cmd->handler == mconsole_go) break; if (req->cmd->handler == mconsole_stop) { ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758952AbYAQVqq (ORCPT ); Thu, 17 Jan 2008 16:46:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756617AbYAQVlq (ORCPT ); Thu, 17 Jan 2008 16:41:46 -0500 Received: from saraswathi.solana.com ([198.99.130.12]:44805 "EHLO saraswathi.solana.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758205AbYAQVlo (ORCPT ); Thu, 17 Jan 2008 16:41:44 -0500 Date: Thu, 17 Jan 2008 16:40:46 -0500 From: Jeff Dike To: Andrew Morton Cc: Karol Swietlicki , uml-devel , LKML Subject: [PATCH 15/20] UML - Fix infinite mconsole loop Message-ID: <20080117214046.GA6762@c2.user-mode-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Karol Swietlicki This patch takes care of a problem with the stopping code. The function inside the while condition returns 0 to signify a problem. A problem could be for example a bad command or a bad version of the mconsole client. A bad command would terminate the stopping loop and resume the kernel. This is a problem. A better solution is to make the loop infinite and don't leave it until we are explicitly told to. Signed-off-by: Karol Swietlicki Signed-off-by: Jeff Dike --- arch/um/drivers/mconsole_kern.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Index: linux-2.6.22/arch/um/drivers/mconsole_kern.c =================================================================== --- linux-2.6.22.orig/arch/um/drivers/mconsole_kern.c 2007-12-12 13:44:20.000000000 -0500 +++ linux-2.6.22/arch/um/drivers/mconsole_kern.c 2007-12-12 15:53:08.000000000 -0500 @@ -305,7 +305,9 @@ void mconsole_stop(struct mc_request *re deactivate_fd(req->originating_fd, MCONSOLE_IRQ); os_set_fd_block(req->originating_fd, 1); mconsole_reply(req, "stopped", 0, 0); - while (mconsole_get_request(req->originating_fd, req)) { + for (;;) { + if (!mconsole_get_request(req->originating_fd, req)) + continue; if (req->cmd->handler == mconsole_go) break; if (req->cmd->handler == mconsole_stop) {