]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tcp: fix mem under-charging with zerocopy sendmsg()
authorEric Dumazet <edumazet@google.com>
Tue, 1 Feb 2022 06:52:54 +0000 (22:52 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Feb 2022 11:39:58 +0000 (12:39 +0100)
commit0c6e3cd1d5ed64e5aa740cd476ddd0dcf76f873b
tree87949791c5a04c4e1dfc7c5aba83989498e75585
parentc074e2c8d67af5f0b1fb953d4ff960a8dc854eab
tcp: fix mem under-charging with zerocopy sendmsg()

commit 479f5547239d970d3833f15f54a6481fffdb91ec upstream.

We got reports of following warning in inet_sock_destruct()

WARN_ON(sk_forward_alloc_get(sk));

Whenever we add a non zero-copy fragment to a pure zerocopy skb,
we have to anticipate that whole skb->truesize will be uncharged
when skb is finally freed.

skb->data_len is the payload length. But the memory truesize
estimated by __zerocopy_sg_from_iter() is page aligned.

Fixes: 9b65b17db723 ("net: avoid double accounting for pure zerocopy skbs")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Talal Ahmad <talalahmad@google.com>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Link: https://lore.kernel.org/r/20220201065254.680532-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/tcp.c