]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.25.8/virtio_net-fix-skb-csum_start-computation.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.25.8 / virtio_net-fix-skb-csum_start-computation.patch
1 From stable-bounces@linux.kernel.org Sun Jun 15 22:10:40 2008
2 From: Mark McLoughlin <markmc@redhat.com>
3 Date: Mon, 16 Jun 2008 14:41:41 +1000
4 Subject: virtio_net: Fix skb->csum_start computation
5 To: stable@kernel.org
6 Cc: virtualization@lists.linux-foundation.org
7 Message-ID: <200806161441.41993.rusty@rustcorp.com.au>
8 Content-Disposition: inline
9
10
11 From: Mark McLoughlin <markmc@redhat.com>
12
13 commit 23cde76d801246a702e7a84c3fe3d655b35c89a1 upstream.
14
15 hdr->csum_start is the offset from the start of the ethernet
16 header to the transport layer checksum field. skb->csum_start
17 is the offset from skb->head.
18
19 skb_partial_csum_set() assumes that skb->data points to the
20 ethernet header - i.e. it computes skb->csum_start by adding
21 the headroom to hdr->csum_start.
22
23 Since eth_type_trans() skb_pull()s the ethernet header,
24 skb_partial_csum_set() should be called before
25 eth_type_trans().
26
27 (Without this patch, GSO packets from a guest to the world outside the
28 host are corrupted).
29
30 Signed-off-by: Mark McLoughlin <markmc@redhat.com>
31 Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
32 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
33 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
34
35 ---
36 drivers/net/virtio_net.c | 8 +++++---
37 1 file changed, 5 insertions(+), 3 deletions(-)
38
39 --- a/drivers/net/virtio_net.c
40 +++ b/drivers/net/virtio_net.c
41 @@ -83,9 +83,7 @@ static void receive_skb(struct net_devic
42 BUG_ON(len > MAX_PACKET_LEN);
43
44 skb_trim(skb, len);
45 - skb->protocol = eth_type_trans(skb, dev);
46 - pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
47 - ntohs(skb->protocol), skb->len, skb->pkt_type);
48 +
49 dev->stats.rx_bytes += skb->len;
50 dev->stats.rx_packets++;
51
52 @@ -95,6 +93,10 @@ static void receive_skb(struct net_devic
53 goto frame_err;
54 }
55
56 + skb->protocol = eth_type_trans(skb, dev);
57 + pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
58 + ntohs(skb->protocol), skb->len, skb->pkt_type);
59 +
60 if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) {
61 pr_debug("GSO!\n");
62 switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) {