From nobody Fri Oct 31 16:12:51 2025 Received: from localhost.localdomain (unknown [147.136.157.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E659C30F94E for ; Tue, 14 Oct 2025 12:36:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=147.136.157.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445400; cv=none; b=uKvwrGbyFdTgkvN3bUqEzxbEnk0jRC+K5gBIjqNfr9jkTPBsyuIVWNMopH6k18+fNLbFSYPS0NjP11i2BY75ciV2jvU9b2pdB34iEZcjfdODsFhljXOltuVRllaUGBT6Z/736DYeNUoK26+V52Q8GZDiSRoO9YNpZySWMgTo6XQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760445400; c=relaxed/simple; bh=k/Tok6k6D/CdQpW7VbJVnHdNR0BBriLH6Ww7ZjTcrIQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kbvPHOH0fgUzpTp5YUDpPUaTxTMBPjzEYi8EaZHuGlcXWrBwgZ91VJ+I90xXUKeAPhD/1PR1O/U3C1SNTJWkYBGbuMGLCdX76Jyi2aUiAEqDFrMle8+kYdtwFdaiHs120NPumZpAE0K18cZChUFR5CImGoV8zvdycCJn/NnPu5k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev; spf=none smtp.mailfrom=localhost.localdomain; arc=none smtp.client-ip=147.136.157.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=localhost.localdomain Received: by localhost.localdomain (Postfix, from userid 1007) id C29D98B2A56; Tue, 14 Oct 2025 20:26:36 +0800 (+08) From: Jiayuan Chen To: mptcp@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Jiayuan Chen , Matthieu Baerts , Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Davide Caratti , netdev@vger.kernel.org Subject: [PATCH net-next v1] mptcp: fix incorrect IPv4/IPv6 check Date: Tue, 14 Oct 2025 20:26:18 +0800 Message-ID: <20251014122619.316463-1-jiayuan.chen@linux.dev> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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 *s= k) { #if IS_ENABLED(CONFIG_MPTCP_IPV6) - if (sk->sk_prot =3D=3D &tcpv6_prot) + if (sk->sk_family =3D=3D AF_INET6) return &inet6_stream_ops; #endif - WARN_ON_ONCE(sk->sk_prot !=3D &tcp_prot); + WARN_ON(sk->sk_family !=3D AF_INET); return &inet_stream_ops; } =20 --=20 2.43.0