From: Greg Kroah-Hartman Date: Fri, 16 Nov 2007 00:57:35 +0000 (-0800) Subject: another tcp patch added to 2.6.23 review cycle X-Git-Tag: v2.6.23.2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=fab7fdb0b8a68f7ae422654f9c7d39e0f5433970;p=thirdparty%2Fkernel%2Fstable-queue.git another tcp patch added to 2.6.23 review cycle --- diff --git a/review-2.6.23-3/series b/review-2.6.23-3/series index 709fb910271..8c1365fe446 100644 --- a/review-2.6.23-3/series +++ b/review-2.6.23-3/series @@ -5,6 +5,7 @@ add-get_unaligned-to-ieee80211_get_radiotap_len.patch fix-advertised-packet-scheduler-timer-resolution.patch fix-9p-protocol-build.patch fix-skb_with_overhead-calculations.patch +tcp-fix-size-calculation-in-sk_stream_alloc_pskb.patch fix-kernel_accept-return-handling.patch softmac-fix-wext-mlme-request-reason-code-endianness.patch fix-error-returns-in-sys_socketpair.patch diff --git a/review-2.6.23-3/tcp-fix-size-calculation-in-sk_stream_alloc_pskb.patch b/review-2.6.23-3/tcp-fix-size-calculation-in-sk_stream_alloc_pskb.patch new file mode 100644 index 00000000000..a9e299ac143 --- /dev/null +++ b/review-2.6.23-3/tcp-fix-size-calculation-in-sk_stream_alloc_pskb.patch @@ -0,0 +1,60 @@ +From fb93134dfc2a6e6fbedc7c270a31da03fce88db9 Mon Sep 17 00:00:00 2001 +From: Herbert Xu +Date: Wed, 14 Nov 2007 15:45:21 -0800 +To: Greg KH +Subject: TCP: Fix size calculation in sk_stream_alloc_pskb + +From: Herbert Xu + +[TCP]: Fix size calculation in sk_stream_alloc_pskb + +[ Upstream commit: fb93134dfc2a6e6fbedc7c270a31da03fce88db9 ] + +We round up the header size in sk_stream_alloc_pskb so that +TSO packets get zero tail room. Unfortunately this rounding +up is not coordinated with the select_size() function used by +TCP to calculate the second parameter of sk_stream_alloc_pskb. + +As a result, we may allocate more than a page of data in the +non-TSO case when exactly one page is desired. + +In fact, rounding up the head room is detrimental in the non-TSO +case because it makes memory that would otherwise be available to +the payload head room. TSO doesn't need this either, all it wants +is the guarantee that there is no tail room. + +So this patch fixes this by adjusting the skb_reserve call so that +exactly the requested amount (which all callers have calculated in +a precise way) is made available as tail room. + +Signed-off-by: Herbert Xu +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + include/net/sock.h | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/include/net/sock.h ++++ b/include/net/sock.h +@@ -1199,14 +1199,16 @@ static inline struct sk_buff *sk_stream_ + gfp_t gfp) + { + struct sk_buff *skb; +- int hdr_len; + +- hdr_len = SKB_DATA_ALIGN(sk->sk_prot->max_header); +- skb = alloc_skb_fclone(size + hdr_len, gfp); ++ skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); + if (skb) { + skb->truesize += mem; + if (sk_stream_wmem_schedule(sk, skb->truesize)) { +- skb_reserve(skb, hdr_len); ++ /* ++ * Make sure that we have exactly size bytes ++ * available to the caller, no more, no less. ++ */ ++ skb_reserve(skb, skb_tailroom(skb) - size); + return skb; + } + __kfree_skb(skb);