Received: from eggs.gnu.org ([2001:4830:134:3::10]:56649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzhEH-0002Pq-Gr for qemu-devel@nongnu.org; Fri, 20 Nov 2015 03:39:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzhEC-0007SN-Hq for qemu-devel@nongnu.org; Fri, 20 Nov 2015 03:39:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzhEC-0007SF-CL for qemu-devel@nongnu.org; Fri, 20 Nov 2015 03:39:32 -0500 Date: Fri, 20 Nov 2015 14:09:19 +0530 (IST) From: P J P In-Reply-To: <1448005353-16007-1-git-send-email-sw@weilnetz.de> Message-ID: References: <1448005353-16007-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH for-2.5] eepro100: Prevent two endless loops List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Developer +-- On Fri, 20 Nov 2015, Stefan Weil wrote --+ | diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c | index 60333b7..685a478 100644 | --- a/hw/net/eepro100.c | +++ b/hw/net/eepro100.c | @@ -774,6 +774,11 @@ static void tx_command(EEPRO100State *s) | #if 0 | uint16_t tx_buffer_el = lduw_le_pci_dma(&s->dev, tbd_address + 6); | #endif | + if (tx_buffer_size == 0) { | + /* Prevent an endless loop. */ | + logout("loop in %s:%u\n", __FILE__, __LINE__); | + break; | + } Yes, looks good. Where is 'lduw_le_pci_dma' routine defined? | static void action_command(EEPRO100State *s) | { | + /* The loop below won't stop if it gets special handcrafted data. | + Therefore we limit the number of iterations. */ | + unsigned max_loop_count = 16; | + Is '16' a lower count for the command list? Earilier Jason mentioned 256. Not sure what is an ideal count. Thank you. -- - P J P 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F