From patchwork Tue Mar 30 04:56:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 48929 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ADBCB7C48 for ; Tue, 30 Mar 2010 15:56:44 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754649Ab0C3E4k (ORCPT ); Tue, 30 Mar 2010 00:56:40 -0400 Received: from ozlabs.org ([203.10.76.45]:47677 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754212Ab0C3E4j (ORCPT ); Tue, 30 Mar 2010 00:56:39 -0400 Received: from vivaldi.localnet (ppp118-210-117-152.lns20.adl2.internode.on.net [118.210.117.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id 97C6DB7C8E; Tue, 30 Mar 2010 15:56:38 +1100 (EST) From: Rusty Russell To: netdev@vger.kernel.org Subject: [PATCH] virtio_net: avoid BUG_ON() with large packets when CONFIG_DEBUG_SG=y Date: Tue, 30 Mar 2010 15:26:35 +1030 User-Agent: KMail/1.12.2 (Linux/2.6.31-19-generic; KDE/4.3.2; i686; ; ) Cc: "Michael S. Tsirkin" MIME-Version: 1.0 Message-Id: <201003301526.35720.rusty@rustcorp.com.au> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org AFAICT only weird kvm setups and lguest traverse this code path now. Signed-off-by: Rusty Russell --- drivers/net/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -351,6 +351,9 @@ static int add_recvbuf_big(struct virtne char *p; int i, err, offset; + /* This is a waste of cycles, but satisfies CONFIG_DEBUG_SG. */ + sg_init_table(sg, ARRAY_SIZE(sg)); + /* page in sg[MAX_SKB_FRAGS + 1] is list tail */ for (i = MAX_SKB_FRAGS + 1; i > 1; --i) { first = get_a_page(vi, gfp);