From: David Laight <david.laight.linux@gmail.com>
To: Hyunwoo Kim <imv4bel@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, ncardwell@google.com, dsahern@kernel.org,
idosch@nvidia.com, kuniyu@google.com, horms@kernel.org,
willemb@google.com, andrew+netdev@lunn.ch, kees@kernel.org,
jiayuan.chen@linux.dev, kerneljasonxing@gmail.com, ij@kernel.org,
martin.lau@kernel.org, shakeel.butt@linux.dev,
matttbe@kernel.org, martineau@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 0/8] net: fixes for requests completing on a socket that no longer listens
Date: Mon, 24 Aug 2026 09:30:44 +0100 [thread overview]
Message-ID: <20260824093044.595dd0fc@pumpkin> (raw)
In-Reply-To: <20260824033331.1084971-1-imv4bel@gmail.com>
On Mon, 24 Aug 2026 12:32:44 +0900
Hyunwoo Kim <imv4bel@gmail.com> wrote:
> connect(AF_UNSPEC) and listen() move a socket back and forth between
> listener and active session. IPV6_ADDRFORM on top of that turns an
> AF_INET6 socket into an AF_INET one.
Is it even valid to call connect() after listen()?
David
>
> Two things follow. One is that what the socket had before the change is
> left behind: requests still in the ehash, and parent fields a child
> inherits. The other is that the socket is used while it is changing.
> tcp_check_req() does not hold the listener lock, and tcp_v{4,6}_rcv()
> reads sk_state twice without it on the listener path.
>
> Patch 2 is neither. After a reuseport migration the listener that counted
> a request and the listener the count is decremented on are not the same.
> It goes with patch 3 because patch 3 needs it. Nothing ever resets that
> count, so patch 3 on its own has a check that can be bypassed.
>
> Patches 2, 6, 7 and 8 are new in v2.
>
> Hyunwoo Kim (8):
> tcp: fix use-after-free of the listener's ipv6_pinfo after
> IPV6_ADDRFORM
> tcp: fix imbalanced icsk_accept_queue count in tcp_check_req()
> ipv6: fix request socket use-after-free after IPV6_ADDRFORM
> net: fix out-of-bounds write in sk_clone() racing with IPV6_ADDRFORM
> tcp: do not inherit out_of_order_queue from parent
> tcp: fix use-after-free in the lockless listener path
> net: clear sk_tsq_flags in sk_clone()
> tcp: do not inherit retransmit state from parent
>
> include/net/tcp.h | 2 ++
> net/core/sock.c | 3 +-
> net/ipv4/tcp_input.c | 64 +++++++++++++++++++++++-----------------
> net/ipv4/tcp_ipv4.c | 52 ++++++++++++++++++++++++++++++--
> net/ipv4/tcp_minisocks.c | 9 +++++-
> net/ipv6/af_inet6.c | 4 +++
> net/ipv6/ipv6_sockglue.c | 15 ++++++++++
> net/ipv6/tcp_ipv6.c | 44 +++++++++++++++++++++++++--
> 8 files changed, 160 insertions(+), 33 deletions(-)
>
next prev parent reply other threads:[~2026-08-24 8:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 3:32 [PATCH net v2 0/8] net: fixes for requests completing on a socket that no longer listens Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 1/8] tcp: fix use-after-free of the listener's ipv6_pinfo after IPV6_ADDRFORM Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 2/8] tcp: fix imbalanced icsk_accept_queue count in tcp_check_req() Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 3/8] ipv6: fix request socket use-after-free after IPV6_ADDRFORM Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 4/8] net: fix out-of-bounds write in sk_clone() racing with IPV6_ADDRFORM Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 5/8] tcp: do not inherit out_of_order_queue from parent Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 6/8] tcp: fix use-after-free in the lockless listener path Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 7/8] net: clear sk_tsq_flags in sk_clone() Hyunwoo Kim
2026-08-24 3:32 ` [PATCH net v2 8/8] tcp: do not inherit retransmit state from parent Hyunwoo Kim
2026-08-24 8:30 ` David Laight [this message]
2026-08-24 12:56 ` [PATCH net v2 0/8] net: fixes for requests completing on a socket that no longer listens Hyunwoo Kim
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=20260824093044.595dd0fc@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=ij@kernel.org \
--cc=imv4bel@gmail.com \
--cc=jiayuan.chen@linux.dev \
--cc=kees@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shakeel.butt@linux.dev \
--cc=willemb@google.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