]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: take care of misalignments
authorEric Dumazet <eric.dumazet@gmail.com>
Sat, 3 Dec 2011 21:39:53 +0000 (21:39 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 4 Dec 2011 18:20:39 +0000 (13:20 -0500)
commit58fb57b346a9fa053810f0d5f515c3c8391d1624
tree88f3a036305da54a62835d900553dda9bc846a8f
parent2ee003b1305ac24f77548fc81c19a65c3dba5e55
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