From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn4KN-0006P4-GN for qemu-devel@nongnu.org; Fri, 16 Oct 2015 08:41:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zn4KK-0006Ou-6r for qemu-devel@nongnu.org; Fri, 16 Oct 2015 08:41:43 -0400 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:35134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn4KK-0006OJ-0f for qemu-devel@nongnu.org; Fri, 16 Oct 2015 08:41:40 -0400 Received: by wicll6 with SMTP id ll6so8125731wic.0 for ; Fri, 16 Oct 2015 05:41:39 -0700 (PDT) Sender: Paolo Bonzini References: From: Paolo Bonzini Message-ID: <5620F082.5040007@redhat.com> Date: Fri, 16 Oct 2015 14:41:38 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] eepro100: prevent an infinite loop over same command block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: P J P , qemu-devel@nongnu.org Cc: Qinghao Tang , Jason Wang On 16/10/2015 13:12, P J P wrote: > Hello, > > An infinite loop issue in hw/net/eepro100.c emulator was reported by Mr > Qinghao Tang(CC'd here). > > Below is a proposed fix patch and details about the issue. > > === > From f06497dfefabbdd6f966a5d6c177d85cd0e5ecd8 Mon Sep 17 00:00:00 2001 > From: Prasad J Pandit > Date: Fri, 16 Oct 2015 11:33:27 +0530 > Subject: eepro100: prevent an infinite loop over same command block > > action_command() routine executes a chain of commands located > in the Command Block List(CBL). Each Command Block(CB) has a > link to the next CB in the list, given by 's->tx.link'. > This is used in conjunction with the base address 's->cu_base'. > > An infinite loop unfolds if the 'link' to the next CB is > same as the previous one, the loop ends up executing the same > command over and over again. > > Reported-by: Qinghao Tang > Signed-off-by: Prasad J Pandit > --- > hw/net/eepro100.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c > index 60333b7..d76d108 100644 > --- a/hw/net/eepro100.c > +++ b/hw/net/eepro100.c > @@ -863,6 +863,8 @@ static void action_command(EEPRO100State *s) > uint16_t ok_status = STATUS_OK; > s->cb_address = s->cu_base + s->cu_offset; > read_cb(s); > + if (s->tx.link == s->cu_offset) > + break; Please update the patch to conform to QEMU's coding standards; braces are required even around single-statement blocks. Paolo > bit_el = ((s->tx.command & COMMAND_EL) != 0); > bit_s = ((s->tx.command & COMMAND_S) != 0); > bit_i = ((s->tx.command & COMMAND_I) != 0);