]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: properly reset skb->truesize for tx recycling
authorEric Dumazet <edumazet@google.com>
Fri, 19 Apr 2019 23:02:03 +0000 (16:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Apr 2019 23:42:33 +0000 (16:42 -0700)
commitb7e5fc08d33cfbe0d50c207c7daf5f50d1787233
treed83b970c017bc2c96286be18e81e20dd43eaaf86
parent92cfc88d34a32ab716f91eb21addbecea21d426b
tcp: properly reset skb->truesize for tx recycling

tcp sendmsg() and sendpage() normally advance skb->data_len
and skb->truesize by the payload added to an skb.

But sendmsg(fd, ..., MSG_ZEROCOPY) has to account for whole pages,
even if a single byte of payload is used in the page.

This means that we can not assume skb->truesize can be adjusted
by skb->data_len. We must instead overwrite its value.

Otherwise skb->truesize is too big and can hit socket sndbuf limit,
especially if the skb is recycled multiple times :/

Fixes: 7ddae09f6567 ("tcp: add one skb cache for tx")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c