From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5C0i-00052w-7c for qemu-devel@nongnu.org; Wed, 07 Mar 2012 03:14:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5C0g-0004EN-94 for qemu-devel@nongnu.org; Wed, 07 Mar 2012 03:14:11 -0500 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:58363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5C0g-00048n-0t for qemu-devel@nongnu.org; Wed, 07 Mar 2012 03:14:10 -0500 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Mar 2012 08:14:01 -0000 Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q278Drdc2781324 for ; Wed, 7 Mar 2012 08:13:53 GMT Received: from d06av09.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q278DqOL011131 for ; Wed, 7 Mar 2012 01:13:52 -0700 Date: Wed, 7 Mar 2012 08:13:51 +0000 From: Stefan Hajnoczi Message-ID: <20120307081351.GA7161@stefanha-thinkpad.localdomain> References: <20120305030824.8515.53602.stgit@jason-ThinkPad-T400> <20120307031748.6355.500.stgit@jason-ThinkPad-T400> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120307031748.6355.500.stgit@jason-ThinkPad-T400> Subject: Re: [Qemu-devel] [1/6 V2 PATCH] rtl8139: limit transmission buffer size in c+ mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: mst@redhat.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, benjamin.poirier@gmail.com, liguori@us.ibm.com, aurelien@aurel32.net On Wed, Mar 07, 2012 at 11:17:48AM +0800, Jason Wang wrote: > The tx buffer would be re-allocated for tx descriptor with big size > and without LS bit set, this would make guest driver could easily let > qemu to allocate unlimited. > > In linux host, a glib failure were easy to be triggered: > > GLib-ERROR **: gmem.c:176: failed to allocate 18446744071562067968 bytes > > This patch fix this by adding a limit. As the spec didn't tell the maximum size > of buffer allowed, stick it to current CP_TX_BUFFER_SIZE (65536). > > Changes from V1: > > Drop the while statement and s->cplus_txbuffer check. > > Signed-off-by: Jason Wang > --- > hw/rtl8139.c | 11 +++++------ > 1 files changed, 5 insertions(+), 6 deletions(-) Reviewed-by: Stefan Hajnoczi