Received: from eggs.gnu.org ([2001:4830:134:3::10]:40760) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn8fh-0005iH-NZ for qemu-devel@nongnu.org; Fri, 16 Oct 2015 13:20:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zn8fe-0005nU-Hw for qemu-devel@nongnu.org; Fri, 16 Oct 2015 13:20:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52334) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zn8fe-0005nA-CT for qemu-devel@nongnu.org; Fri, 16 Oct 2015 13:19:58 -0400 Date: Fri, 16 Oct 2015 22:49:51 +0530 (IST) From: P J P In-Reply-To: <5620F082.5040007@redhat.com> Message-ID: References: <5620F082.5040007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: Paolo Bonzini Cc: Qinghao Tang , Jason Wang , qemu-devel@nongnu.org +-- On Fri, 16 Oct 2015, Paolo Bonzini wrote --+ | > + 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. Done. Please see an updated patch below. === >From bbf7b8914a984b09242e1cafc258bd71cecc47c8 Mon Sep 17 00:00:00 2001 From: Prasad J Pandit Date: Fri, 16 Oct 2015 22:43:29 +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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 60333b7..0e4ad4e 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -863,6 +863,9 @@ 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; + } bit_el = ((s->tx.command & COMMAND_EL) != 0); bit_s = ((s->tx.command & COMMAND_S) != 0); bit_i = ((s->tx.command & COMMAND_I) != 0); -- 2.4.3 === Thank you. -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F