tcp_create_openreq_child() copies icsk_ca_priv and icsk_ca_initialized from the listener. tcp_ca_openreq_child() can select a different CA for the child without clearing either field. If the child uses CDG, tcp_cdg_init() allocates a new gradients array but leaves the copied tail index in place. That index can be outside the new array. Clear icsk_ca_priv and reset icsk_ca_initialized before selecting the child's CA and calling tcp_set_ca_state(). Do not run the listener's release callback on the copy. Fixes: 81164413ad09 ("net: tcp: add per route congestion control") Reported-by: Alexei Starovoitov Link: https://lore.kernel.org/netdev/DNASOXUN4KAE.1IJL3LGF4E1DO@gmail.com/ Cc: stable@vger.kernel.org Signed-off-by: Paul Moses --- Backport prereq: apply Jiayuan Chen's clone-hook ordering fix first, so the child cannot already own CA state at the reset below: https://lore.kernel.org/bpf/20261130041156.295524-1-jiayuan.chen@linux.dev/ net/ipv4/tcp_minisocks.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 934012cdac27..2f9f84bf8768 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -500,6 +500,9 @@ void tcp_ca_openreq_child(struct sock *sk, const struct dst_entry *dst) u32 ca_key = dst_metric(dst, RTAX_CC_ALGO); bool ca_got_dst = false; + icsk->icsk_ca_initialized = 0; + memset(icsk->icsk_ca_priv, 0, sizeof(icsk->icsk_ca_priv)); + if (ca_key != TCP_CA_UNSPEC) { const struct tcp_congestion_ops *ca; -- 2.56.0.lol.gf7de81456940