diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2015-10-27 22:40:40 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-01 12:01:27 -0500 |
commit | dbd3393c56a8794fe596e7dd20d0efa613b9cf61 (patch) | |
tree | 3a6b5ade5ee0044ef766b753738945295e3b248c /net/ipv4/ip_output.c | |
parent | d749c9cbffd666956694f307d237e018c464d973 (diff) | |
download | op-kernel-dev-dbd3393c56a8794fe596e7dd20d0efa613b9cf61.zip op-kernel-dev-dbd3393c56a8794fe596e7dd20d0efa613b9cf61.tar.gz |
ipv4: add defensive check for CHECKSUM_PARTIAL skbs in ip_fragment
CHECKSUM_PARTIAL skbs should never arrive in ip_fragment. If we get one
of those warn about them once and handle them gracefully by recalculating
the checksum.
Cc: Eric Dumazet <edumazet@google.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Benjamin Coddington <bcodding@redhat.com>
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r-- | net/ipv4/ip_output.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 0b02417..4233cbe 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -533,6 +533,11 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, dev = rt->dst.dev; + /* for offloaded checksums cleanup checksum before fragmentation */ + if (skb->ip_summed == CHECKSUM_PARTIAL && + (err = skb_checksum_help(skb))) + goto fail; + /* * Point into the IP datagram header. */ @@ -657,9 +662,6 @@ slow_path_clean: } slow_path: - /* for offloaded checksums cleanup checksum before fragmentation */ - if ((skb->ip_summed == CHECKSUM_PARTIAL) && skb_checksum_help(skb)) - goto fail; iph = ip_hdr(skb); left = skb->len - hlen; /* Space per frame */ |