tcp: take care of misalignments
commit117632e64d2a5f464e491fe221d7169a3814a77b
authorEric Dumazet <eric.dumazet@gmail.com>
Sat, 3 Dec 2011 21:39:53 +0000 (3 21:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 4 Dec 2011 18:20:39 +0000 (4 13:20 -0500)
tree88f3a036305da54a62835d900553dda9bc846a8f
parentc2e4e25afcc8ae1835a6100089f1f9fd3a362430
tcp: take care of misalignments

We discovered that TCP stack could retransmit misaligned skbs if a
malicious peer acknowledged sub MSS frame. This currently can happen
only if output interface is non SG enabled : If SG is enabled, tcp
builds headless skbs (all payload is included in fragments), so the tcp
trimming process only removes parts of skb fragments, header stay
aligned.

Some arches cant handle misalignments, so force a head reallocation and
shrink headroom to MAX_TCP_HEADER.

Dont care about misaligments on x86 and PPC (or other arches setting
NET_IP_ALIGN to 0)

This patch introduces __pskb_copy() which can specify the headroom of
new head, and pskb_copy() becomes a wrapper on top of __pskb_copy()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h
net/core/skbuff.c
net/ipv4/tcp_output.c