summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_offload.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2013-11-22 10:31:29 +0800
committerDavid S. Miller <davem@davemloft.net>2013-11-23 14:46:19 -0800
commitcc5c00bbb44c5d68b883aa5cb9d01514a2525d94 (patch)
treee09c2d77f476ef4584308510c30601d518d91f68 /net/ipv4/tcp_offload.c
parentd6c416148545bd99d3cc05e672460168245cc156 (diff)
downloadop-kernel-dev-cc5c00bbb44c5d68b883aa5cb9d01514a2525d94.zip
op-kernel-dev-cc5c00bbb44c5d68b883aa5cb9d01514a2525d94.tar.gz
gro: Only verify TCP checksums for candidates
In some cases we may receive IP packets that are longer than their stated lengths. Such packets are never merged in GRO. However, we may end up computing their checksums incorrectly and end up allowing packets with a bogus checksum enter our stack with the checksum status set as verified. Since such packets are rare and not performance-critical, this patch simply skips the checksum verification for them. Reported-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: Alexander Duyck <alexander.h.duyck@intel.com> Thanks, Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_offload.c')
-rw-r--r--net/ipv4/tcp_offload.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index a2b68a1..55aeec9 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -276,6 +276,10 @@ static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *
__wsum wsum;
__sum16 sum;
+ /* Don't bother verifying checksum if we're going to flush anyway. */
+ if (NAPI_GRO_CB(skb)->flush)
+ goto skip_csum;
+
switch (skb->ip_summed) {
case CHECKSUM_COMPLETE:
if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr,
@@ -301,6 +305,7 @@ flush:
break;
}
+skip_csum:
return tcp_gro_receive(head, skb);
}
OpenPOWER on IntegriCloud