]> git.itanic.dy.fi Git - linux-stable/commit
tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path
authorTalal Ahmad <talalahmad@google.com>
Fri, 9 Jul 2021 15:43:06 +0000 (11:43 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Jul 2021 12:37:36 +0000 (14:37 +0200)
commite023c648a7646304b929d43f9b3bdc4431dd0093
tree732b98b4fa5abe4888af18af03873226d0f16d39
parentc0fea93d9f778d74b24ab324c8f9c2bffdcd35ee
tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path

commit 358ed624207012f03318235017ac6fb41f8af592 upstream.

sk_wmem_schedule makes sure that sk_forward_alloc has enough
bytes for charging that is going to be done by sk_mem_charge.

In the transmit zerocopy path, there is sk_mem_charge but there was
no call to sk_wmem_schedule. This change adds that call.

Without this call to sk_wmem_schedule, sk_forward_alloc can go
negetive which is a bug because sk_forward_alloc is a per-socket
space that has been forward charged so this can't be negative.

Fixes: f214f915e7db ("tcp: enable MSG_ZEROCOPY")
Signed-off-by: Talal Ahmad <talalahmad@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Wei Wang <weiwan@google.com>
Reviewed-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/tcp.c