From: Kuniyuki Iwashima <kuniyu@google.com>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@kernel.org>,
Neal Cardwell <ncardwell@google.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Florian Westphal <fw@strlen.de>,
Daniel Borkmann <daniel@iogearbox.net>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net] tcp: fix CA module refcount underflow in tcp_v4_syn_recv_sock()
Date: Sun, 29 Nov 2026 23:48:30 +0000 [thread overview]
Message-ID: <awy5xVKOqlxeucEY@google.com> (raw)
In-Reply-To: <20261124062625.264148-1-jiayuan.chen@linux.dev>
On Tue, 24 Nov 2026 14:26:24 +0800, Jiayuan Chen wrote:
> Issue found by sashiko [1].
>
> tcp_v4_syn_recv_sock() creates the child with tcp_create_openreq_child(),
> which inherits icsk->icsk_ca_ops from the listener without taking a
> reference. The reference is only taken later in tcp_ca_openreq_child().
> If inet_csk_route_child_sock() fails in between, we go to put_and_exit
> and tcp_done() ends up in tcp_cleanup_congestion_control(), which puts
> the reference unconditionally. The one dropped belongs to the listener.
>
> Seen with a listener using bbr (built as a module) and TCP_DEFER_ACCEPT:
> make the route to the client prohibited once the handshake is done, then
> let the client send data.
>
> WARNING: kernel/module/main.c:969 at module_put.part.0+0x97/0x160, CPU#1: swapper/1/0
> Modules linked in: tcp_bbr(OE)
> RIP: 0010:module_put.part.0+0x97/0x160
> Call Trace:
> <IRQ>
> module_put+0x13/0x30
> tcp_cleanup_congestion_control+0xae/0xe0
> tcp_v4_destroy_sock+0x103/0x360
> inet_csk_destroy_sock+0xb7/0x1e0
> tcp_done+0x146/0x1e0
> tcp_v4_syn_recv_sock+0x73a/0x9f0
> tcp_check_req+0x351/0x1130
> tcp_v4_rcv+0xe82/0x22e0
> ip_protocol_deliver_rcu+0x5f/0x340
> ip_local_deliver_finish+0x19f/0x3a0
> ip_local_deliver+0xc9/0xf0
> ip_rcv+0x1b1/0x1c0
> __netif_receive_skb_one_core+0xc4/0xe0
> __netif_receive_skb+0x23/0xb0
> process_backlog+0x27a/0x950
> __napi_poll.constprop.0+0x61/0x2c0
> net_rx_action+0x372/0x800
> handle_softirqs+0x109/0x570
> </IRQ>
>
> Options considered:
> 1. Take the reference in tcp_create_openreq_child(), see the diff below
> the "---". It adds a get/put pair on the passive open path.
> 2. Point the child at tcp_reno (built in, no owner) on this error path,
> so the put becomes a no-op. It works but looks odd.
>
> Instead, clear icsk_ca_ops on this error path and make
> tcp_cleanup_congestion_control() skip a socket without a CA.
>
> [1] https://sashiko.dev/#/message/20260606095014.2531B1F00893%40smtp.kernel.org
>
> Fixes: 81164413ad09 ("net: tcp: add per route congestion control")
> Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
prev parent reply other threads:[~2026-11-29 23:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 6:26 Jiayuan Chen
2026-11-25 6:26 ` netdev-bot+sashiko
2026-11-25 6:37 ` Jiayuan Chen
2026-11-29 23:48 ` Kuniyuki Iwashima [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awy5xVKOqlxeucEY@google.com \
--to=kuniyu@google.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=jiayuan.chen@linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®