This is a note to let you know that I've just added the patch titled tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: tcp-call-sk_wmem_schedule-before-sk_mem_charge-in-zerocopy-path.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 358ed624207012f03318235017ac6fb41f8af592 Mon Sep 17 00:00:00 2001 From: Talal Ahmad <talalahmad@xxxxxxxxxx> Date: Fri, 9 Jul 2021 11:43:06 -0400 Subject: tcp: call sk_wmem_schedule before sk_mem_charge in zerocopy path From: Talal Ahmad <talalahmad@xxxxxxxxxx> 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@xxxxxxxxxx> Reviewed-by: Willem de Bruijn <willemb@xxxxxxxxxx> Reviewed-by: Wei Wang <weiwan@xxxxxxxxxx> Reviewed-by: Soheil Hassas Yeganeh <soheil@xxxxxxxxxx> Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/ipv4/tcp.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1361,6 +1361,9 @@ new_segment: } pfrag->offset += copy; } else { + if (!sk_wmem_schedule(sk, copy)) + goto wait_for_space; + err = skb_zerocopy_iter_stream(sk, skb, msg, copy, uarg); if (err == -EMSGSIZE || err == -EEXIST) { tcp_mark_push(tp, skb); Patches currently in stable-queue which might be from talalahmad@xxxxxxxxxx are queue-5.10/tcp-call-sk_wmem_schedule-before-sk_mem_charge-in-zerocopy-path.patch