diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 480469b92aa7c7b029a243373bfe55deba21d508..bc9e57550e86d9b4f5b9ee965466f3d4f52f2585 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1016,8 +1016,6 @@ int ip_append_data(struct sock *sk, skb_fill_page_desc(skb, i, page, 0, 0); frag = &skb_shinfo(skb)->frags[i]; - skb->truesize += PAGE_SIZE; - atomic_add(PAGE_SIZE, &sk->sk_wmem_alloc); } else { err = -EMSGSIZE; goto error; @@ -1030,6 +1028,8 @@ int ip_append_data(struct sock *sk, frag->size += copy; skb->len += copy; skb->data_len += copy; + skb->truesize += copy; + atomic_add(copy, &sk->sk_wmem_alloc); } offset += copy; length -= copy; diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 6338a9c1aa14e2a0f832db6d40d69df678dc09be..3bef30e4a23d870e6c8d55c253412ce1356f01ca 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1316,8 +1316,6 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, skb_fill_page_desc(skb, i, page, 0, 0); frag = &skb_shinfo(skb)->frags[i]; - skb->truesize += PAGE_SIZE; - atomic_add(PAGE_SIZE, &sk->sk_wmem_alloc); } else { err = -EMSGSIZE; goto error; @@ -1330,6 +1328,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, frag->size += copy; skb->len += copy; skb->data_len += copy; + skb->truesize += copy; + atomic_add(copy, &sk->sk_wmem_alloc); } offset += copy; length -= copy;