From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8Jp8-0003S6-7H for qemu-devel@nongnu.org; Thu, 15 Mar 2012 19:11:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8Jp6-0000Ak-KL for qemu-devel@nongnu.org; Thu, 15 Mar 2012 19:11:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8Jp6-0000AT-Cl for qemu-devel@nongnu.org; Thu, 15 Mar 2012 19:11:08 -0400 Date: Fri, 16 Mar 2012 01:01:40 +0200 From: "Michael S. Tsirkin" Message-ID: <20120315230140.GB12879@redhat.com> References: <20120305030824.8515.53602.stgit@jason-ThinkPad-T400> <20120307031748.6355.500.stgit@jason-ThinkPad-T400> <20120307081351.GA7161@stefanha-thinkpad.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120307081351.GA7161@stefanha-thinkpad.localdomain> 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: Stefan Hajnoczi Cc: Jason Wang , qemu-devel@nongnu.org, blauwirbel@gmail.com, benjamin.poirier@gmail.com, liguori@us.ibm.com, aurelien@aurel32.net On Wed, Mar 07, 2012 at 08:13:51AM +0000, Stefan Hajnoczi wrote: > 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 Applied, thanks everyone.