diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-18 21:48:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-18 21:48:08 -0500 |
commit | 21df56c6e2372e09c916111efb6c14c372a5ab2e (patch) | |
tree | c5b8e2c6f5a9951b267137229cb18e2b53878d01 /include/net | |
parent | 483b23ffa3a5f44767038b0a676d757e0668437e (diff) |
[TCP]: Fix TCP header misalignment
Indeed my previous change to alloc_pskb has made it possible
for the TCP header to be misaligned iff the MTU is not a multiple
of 4 (and less than a page). So I suspect the optimised IPsec
MTU calculation is giving you just such an MTU :)
This patch fixes it by changing alloc_pskb to make sure that
the size is at least 32-bit aligned. This does not cause the
problem fixed by the previous patch because max_header is always
32-bit aligned which means that in the SG/NOTSO case this will
be a no-op.
I thought about putting this in the callers but all the current
callers are from TCP. If and when we get a non-TCP caller we
can always create a TCP wrapper for this function and move the
alignment over there.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sock.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 567e468d7492..67e35c7e230c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1236,6 +1236,9 @@ static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | |||
1236 | { | 1236 | { |
1237 | struct sk_buff *skb; | 1237 | struct sk_buff *skb; |
1238 | 1238 | ||
1239 | /* The TCP header must be at least 32-bit aligned. */ | ||
1240 | size = ALIGN(size, 4); | ||
1241 | |||
1239 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | 1242 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); |
1240 | if (skb) { | 1243 | if (skb) { |
1241 | skb->truesize += mem; | 1244 | skb->truesize += mem; |