[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251014122619.316463-1-jiayuan.chen@linux.dev>
Date: Tue, 14 Oct 2025 20:26:18 +0800
From: Jiayuan Chen <jiayuan.chen@...ux.dev>
To: mptcp@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: Jiayuan Chen <jiayuan.chen@...ux.dev>,
Matthieu Baerts <matttbe@...nel.org>,
Mat Martineau <martineau@...nel.org>,
Geliang Tang <geliang@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Davide Caratti <dcaratti@...hat.com>,
netdev@...r.kernel.org
Subject: [PATCH net-next v1] mptcp: fix incorrect IPv4/IPv6 check
When MPTCP falls back to normal TCP, it needs to reset proto_ops. However,
for sockmap and TLS, they have their own custom proto_ops, so simply
checking sk->sk_prot is insufficient.
For example, an IPv6 request might incorrectly follow the IPv4 code path,
leading to kernel panic.
Note that Golang has enabled MPTCP by default [1]
[1] https://go-review.googlesource.com/c/go/+/607715
Fixes: 8e2b8a9fa512 ("mptcp: don't overwrite sock_ops in mptcp_is_tcpsk()")
Signed-off-by: Jiayuan Chen <jiayuan.chen@...ux.dev>
---
net/mptcp/protocol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 0292162a14ee..efcdaeff91f8 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -62,10 +62,10 @@ static u64 mptcp_wnd_end(const struct mptcp_sock *msk)
static const struct proto_ops *mptcp_fallback_tcp_ops(const struct sock *sk)
{
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
- if (sk->sk_prot == &tcpv6_prot)
+ if (sk->sk_family == AF_INET6)
return &inet6_stream_ops;
#endif
- WARN_ON_ONCE(sk->sk_prot != &tcp_prot);
+ WARN_ON(sk->sk_family != AF_INET);
return &inet_stream_ops;
}
--
2.43.0
Powered by blists - more mailing lists