This is a note to let you know that I've just added the patch titled tcp: remove dead code from tcp_sendmsg_locked() to the 5.15-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-remove-dead-code-from-tcp_sendmsg_locked.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 91a98ca6eaaa2065d80085257a52506d8a36f9e5 Author: Eric Dumazet <edumazet@xxxxxxxxxx> Date: Wed Oct 27 13:19:17 2021 -0700 tcp: remove dead code from tcp_sendmsg_locked() [ Upstream commit 3ded97bc41a1e76e1e72eeb192331c01ceacc4bc ] TCP sendmsg() no longer puts payload in skb head, we can remove dead code. Signed-off-by: Eric Dumazet <edumazet@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Stable-dep-of: 72377ab2d671 ("mptcp: more conservative check for zero probes") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index a91cf000bb61b..2115a0e5c98f7 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1330,14 +1330,7 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) if (copy > msg_data_left(msg)) copy = msg_data_left(msg); - /* Where to copy to? */ - if (skb_availroom(skb) > 0 && !zc) { - /* We have some space in skb head. Superb! */ - copy = min_t(int, copy, skb_availroom(skb)); - err = skb_add_data_nocache(sk, skb, &msg->msg_iter, copy); - if (err) - goto do_fault; - } else if (!zc) { + if (!zc) { bool merge = true; int i = skb_shinfo(skb)->nr_frags; struct page_frag *pfrag = sk_page_frag(sk); @@ -1437,7 +1430,6 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size) do_error: skb = tcp_write_queue_tail(sk); -do_fault: tcp_remove_empty_skb(sk, skb); if (copied + copied_syn)