aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_output.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2008-01-23 01:39:26 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-23 06:11:43 -0500
commitf945fa7ad9c12a3356a3de7fb2143ccc2f2c3bca (patch)
tree2dd386474d0ab5e728af671c2b2eafdacc099f09 /net/ipv6/ip6_output.c
parentff4b950277b6534caab2b2b956dba6ce29757551 (diff)
[INET]: Fix truesize setting in ip_append_data
As it is ip_append_data only counts page fragments to the skb that allocated it. As such it means that the first skb gets hit with a 4K charge even though it might have only used a fraction of it while all subsequent skb's that use the same page gets away with no charge at all. This bug was exposed by the UDP accounting patch. [ The wmem_alloc bumping needs to be moved with the truesize, noticed by Takahiro Yasui. -DaveM ] Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r--net/ipv6/ip6_output.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 6338a9c1aa14..3bef30e4a23d 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1316,8 +1316,6 @@ alloc_new_skb:
1316 1316
1317 skb_fill_page_desc(skb, i, page, 0, 0); 1317 skb_fill_page_desc(skb, i, page, 0, 0);
1318 frag = &skb_shinfo(skb)->frags[i]; 1318 frag = &skb_shinfo(skb)->frags[i];
1319 skb->truesize += PAGE_SIZE;
1320 atomic_add(PAGE_SIZE, &sk->sk_wmem_alloc);
1321 } else { 1319 } else {
1322 err = -EMSGSIZE; 1320 err = -EMSGSIZE;
1323 goto error; 1321 goto error;
@@ -1330,6 +1328,8 @@ alloc_new_skb:
1330 frag->size += copy; 1328 frag->size += copy;
1331 skb->len += copy; 1329 skb->len += copy;
1332 skb->data_len += copy; 1330 skb->data_len += copy;
1331 skb->truesize += copy;
1332 atomic_add(copy, &sk->sk_wmem_alloc);
1333 } 1333 }
1334 offset += copy; 1334 offset += copy;
1335 length -= copy; 1335 length -= copy;