From 7c866d6f3bcf72bb7cf1098b894216ab928346c6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 5 Mar 2025 16:48:58 +0000 Subject: [PATCH] Revert "tcp: drop secpath at the same time as we currently drop dst" This reverts commit cd34a07f744451e2ecf9005bb7d24d0b2fb83656 which is commit 9b6412e6979f6f9e0632075f8f008937b5cd4efd upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I8921be76c0f97b5a60009e4521413f6d5409e0b9 Signed-off-by: Greg Kroah-Hartman --- include/net/tcp.h | 14 -------------- net/ipv4/tcp_fastopen.c | 4 ++-- net/ipv4/tcp_input.c | 8 ++++---- net/ipv4/tcp_ipv4.c | 2 +- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 3255a199ef60..3de8bd9c5166 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -684,19 +683,6 @@ void tcp_fin(struct sock *sk); void tcp_check_space(struct sock *sk); void tcp_sack_compress_send_ack(struct sock *sk); -static inline void tcp_cleanup_skb(struct sk_buff *skb) -{ - skb_dst_drop(skb); - secpath_reset(skb); -} - -static inline void tcp_add_receive_queue(struct sock *sk, struct sk_buff *skb) -{ - DEBUG_NET_WARN_ON_ONCE(skb_dst(skb)); - DEBUG_NET_WARN_ON_ONCE(secpath_exists(skb)); - __skb_queue_tail(&sk->sk_receive_queue, skb); -} - /* tcp_timer.c */ void tcp_init_xmit_timers(struct sock *); static inline void tcp_clear_xmit_timers(struct sock *sk) diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 32b28fc21b63..0f523cbfe329 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c @@ -178,7 +178,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) if (!skb) return; - tcp_cleanup_skb(skb); + skb_dst_drop(skb); /* segs_in has been initialized to 1 in tcp_create_openreq_child(). * Hence, reset segs_in to 0 before calling tcp_segs_in() * to avoid double counting. Also, tcp_segs_in() expects @@ -195,7 +195,7 @@ void tcp_fastopen_add_skb(struct sock *sk, struct sk_buff *skb) TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_SYN; tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq; - tcp_add_receive_queue(sk, skb); + __skb_queue_tail(&sk->sk_receive_queue, skb); tp->syn_data_acked = 1; /* u64_stats_update_begin(&tp->syncp) not needed here, diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0a4bc922f0ca..ff6b0ff42398 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4978,7 +4978,7 @@ static void tcp_ofo_queue(struct sock *sk) tcp_rcv_nxt_update(tp, TCP_SKB_CB(skb)->end_seq); fin = TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN; if (!eaten) - tcp_add_receive_queue(sk, skb); + __skb_queue_tail(&sk->sk_receive_queue, skb); else kfree_skb_partial(skb, fragstolen); @@ -5170,7 +5170,7 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, skb, fragstolen)) ? 1 : 0; tcp_rcv_nxt_update(tcp_sk(sk), TCP_SKB_CB(skb)->end_seq); if (!eaten) { - tcp_add_receive_queue(sk, skb); + __skb_queue_tail(&sk->sk_receive_queue, skb); skb_set_owner_r(skb, sk); } return eaten; @@ -5253,7 +5253,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) __kfree_skb(skb); return; } - tcp_cleanup_skb(skb); + skb_dst_drop(skb); __skb_pull(skb, tcp_hdr(skb)->doff * 4); reason = SKB_DROP_REASON_NOT_SPECIFIED; @@ -6222,7 +6222,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPHPHITS); /* Bulk data transfer: receiver */ - tcp_cleanup_skb(skb); + skb_dst_drop(skb); __skb_pull(skb, tcp_header_len); eaten = tcp_queue_rcv(sk, skb, &fragstolen); diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 5a7634b3d659..e98e44b666fe 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2028,7 +2028,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb, */ skb_condense(skb); - tcp_cleanup_skb(skb); + skb_dst_drop(skb); if (unlikely(tcp_checksum_complete(skb))) { bh_unlock_sock(sk);