From patchwork Sun Oct 25 17:03:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 55774 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9PH6Fud031118 for ; Sun, 25 Oct 2009 17:06:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbZJYRGE (ORCPT ); Sun, 25 Oct 2009 13:06:04 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752845AbZJYRGE (ORCPT ); Sun, 25 Oct 2009 13:06:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57662 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752338AbZJYRGD (ORCPT ); Sun, 25 Oct 2009 13:06:03 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9PH62MI003486; Sun, 25 Oct 2009 13:06:02 -0400 Received: from redhat.com (vpn-6-117.tlv.redhat.com [10.35.6.117]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n9PH5wdv023734; Sun, 25 Oct 2009 13:05:59 -0400 Date: Sun, 25 Oct 2009 19:03:40 +0200 From: "Michael S. Tsirkin" To: virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, Rusty Russell Subject: [PATCH] virtio-net: fix data corruption with OOM Message-ID: <20091025170340.GA22099@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 8d00976..be459e1 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -517,8 +517,7 @@ again: /* Free up any pending old buffers before queueing new ones. */ free_old_xmit_skbs(vi); - /* Put new one in send queue and do transmit */ - __skb_queue_head(&vi->send, skb); + /* Try to transmit */ capacity = xmit_skb(vi, skb); /* This can happen with OOM and indirect buffers. */ @@ -532,8 +531,11 @@ again: } return NETDEV_TX_BUSY; } - vi->svq->vq_ops->kick(vi->svq); + + /* Put new one in send queue */ + __skb_queue_head(&vi->send, skb); + /* Don't wait up for transmitted skbs to be freed. */ skb_orphan(skb); nf_reset(skb);