From nobody Sun Dec 14 06:34:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 815FC393DC3; Fri, 5 Dec 2025 18:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960933; cv=none; b=HOpJnSwa4T4OrR+OW/c4y+gU45mYOI8sdi8sJGpaJGo+sKOpOtxApRiTu8dzHrTaSgNCNMy/uYfcYt8uGZXBtan7psq3AE4d46HlxgXz2Kt+3nbghGM7Fy16DwxauEdsbzMQVzYkjlcZ0NwQUix+J9ALLObl0xYrcOzpj3PUTMg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960933; c=relaxed/simple; bh=DYcgUyRPCbhHVUeeLI22n/mljYVmmFnZoPtgjphW1Bs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dIYlnqWDZ7Z7CaojfCy6uhff1O5gf6YGKkp6QaOpSMgKgjPqKGBlxFMn+7Qz3Sp3rhUsPZfnZ0ix9TtUze3bPohWju4Tvaezc7qDIc4gbhe+pZoSBF8qV06+dzy4wB3DyHsMP3sPzqcBkSaSgEmj34XBoxpxJJgmmq805BgBl0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uXCDpVrA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uXCDpVrA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 731F8C116B1; Fri, 5 Dec 2025 18:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764960933; bh=DYcgUyRPCbhHVUeeLI22n/mljYVmmFnZoPtgjphW1Bs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uXCDpVrAt5NtmcjwQh1FVMt+l7vt22Mkq5JU7Oc3pufEJvM/Wcw62dyS1QqHi27cn NqYEeemURKKC+knz6qGST+EEtcUr3AF4Qyyv8dQ6B34v52VXOIuOB1tWL/9Xh4g3JD I1XBkCpovGZdVNCwl+N/d6kSTCK+AcrxcuuH3JUHguYLmbeG3dRRFYJpzgl/RHJvZS bGJWRWmB6YVV5u3DZls55iPLPlf6lzNfj//drheEcWFJ8V53yQmCCxuw1mxVAa+uLI +RTv2O/7L0iJOJ+noUkQiNS8VqVXKp18RTTfyb7SMBr9hLhx15oRiW5Mvu+e+x0lH+ IEppz/NW7RnXw== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Dec 2025 19:55:14 +0100 Subject: [PATCH net 1/4] mptcp: pm: ignore unknown endpoint flags Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-1-9e4781a6c1b8@kernel.org> References: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> In-Reply-To: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , Kuniyuki Iwashima , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2373; i=matttbe@kernel.org; h=from:subject:message-id; bh=DYcgUyRPCbhHVUeeLI22n/mljYVmmFnZoPtgjphW1Bs=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKNtWadbZi2p0l1894fT6rNRDhuiAjN/ucYepk9cfO8a 9t9O680dpSyMIhxMciKKbJIt0Xmz3xexVvi5WcBM4eVCWQIAxenAExEhJ+RodvhxHwLgW7PWYcv XpY3YDJ3qxOcXHzxYf6ZCWftFXcz5DEy/PFdkzZbZHt5m6RfhW+y4i6BW9Jmny7UTtn7XKPc07e IHQA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Before this patch, the kernel was saving any flags set by the userspace, even unknown ones. This doesn't cause critical issues because the kernel is only looking at specific ones. But on the other hand, endpoints dumps could tell the userspace some recent flags seem to be supported on older kernel versions. Instead, ignore all unknown flags when parsing them. By doing that, the userspace can continue to set unsupported flags, but it has a way to verify what is supported by the kernel. Note that it sounds better to continue accepting unsupported flags not to change the behaviour, but also that eases things on the userspace side by adding "optional" endpoint types only supported by newer kernel versions without having to deal with the different kernel versions. A note for the backports: there will be conflicts in mptcp.h on older versions not having the mentioned flags, the new line should still be added last, and the '5' needs to be adapted to have the same value as the last entry. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- include/uapi/linux/mptcp.h | 1 + net/mptcp/pm_netlink.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 04eea6d1d0a9..72a5d030154e 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -40,6 +40,7 @@ #define MPTCP_PM_ADDR_FLAG_FULLMESH _BITUL(3) #define MPTCP_PM_ADDR_FLAG_IMPLICIT _BITUL(4) #define MPTCP_PM_ADDR_FLAG_LAMINAR _BITUL(5) +#define MPTCP_PM_ADDR_FLAGS_MASK GENMASK(5, 0) =20 struct mptcp_info { __u8 mptcpi_subflows; diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index d5b383870f79..7aa42de9c47b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -119,7 +119,8 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct ge= nl_info *info, } =20 if (tb[MPTCP_PM_ADDR_ATTR_FLAGS]) - entry->flags =3D nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]); + entry->flags =3D nla_get_u32(tb[MPTCP_PM_ADDR_ATTR_FLAGS]) & + MPTCP_PM_ADDR_FLAGS_MASK; =20 if (tb[MPTCP_PM_ADDR_ATTR_PORT]) entry->addr.port =3D htons(nla_get_u16(tb[MPTCP_PM_ADDR_ATTR_PORT])); --=20 2.51.0 From nobody Sun Dec 14 06:34:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7A3B5393DC3; Fri, 5 Dec 2025 18:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960936; cv=none; b=te60ff9eyI+Nt9ofwjuEbYtrvBu6CujziZKHCNsueM89bSM9kw10nPnfPIKWOSISZAjjoguTqs67o/rV9yqVsmUxnvX08xZ6WILqFimhujE9A6vtGqHP9wm+gJbotnIgcee70AwXiux1f+1VxVzXtMX4HhRcopoy+cJ0X28ZRBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960936; c=relaxed/simple; bh=mz6UZ0Fkl3I96HVniQu7TrDz6mQBiwxr06agl69nywY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bAnNUAh3J57kHb0MMw2trQvz4Szg0VitMNrWpethxybW4x7V+Dn5W8o3R0cdg6uxn/hhNKORnACM1WEMWiqhAvY58FrV3OW9HlpboHkucF0tn1Dr+bGPgvcm0PtgKPxvwdMK9XkjcmNd3jYun+zm0PuKse5f717n+MQmgNeuc+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qQF7vjRU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qQF7vjRU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BF2CC4CEF1; Fri, 5 Dec 2025 18:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764960936; bh=mz6UZ0Fkl3I96HVniQu7TrDz6mQBiwxr06agl69nywY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qQF7vjRU90HwN3rcsqQsVihtxyqgt2R7+8rMYAlnE2Qr0t8YGJDs5L2rLl2OkRyXA 9h1MOv0irnVxtxzPvrKO5wfZE9APx2wp0yldZIulJCUVLO8ujKqGLykg1qE/sfBeJ1 2ILSMDYW7vHiIClfII3HxgovJaiU3gIdGm59uV4nS2eyrci+J/Np/ILGOEQcxKmWhU chkY6MVzfId9Pvd3OxiGYucpMxBY44LLm3ZG+cwd1V8JZqObmWFbcaxF+AQAx31e4R istvjs8zKxlG7VcyYGJcjGPMOiH3wJ4NtVc0WZlvOEf9gpN5NuFRZTcDEIhTw9jr3X 4CJmOrd9wbuGQ== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Dec 2025 19:55:15 +0100 Subject: [PATCH net 2/4] selftests: mptcp: pm: ensure unknown flags are ignored Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-2-9e4781a6c1b8@kernel.org> References: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> In-Reply-To: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , Kuniyuki Iwashima , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2648; i=matttbe@kernel.org; h=from:subject:message-id; bh=mz6UZ0Fkl3I96HVniQu7TrDz6mQBiwxr06agl69nywY=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKNtebIPhBqrfuzx273o/4Oh++2V4qENZtLBeaviQlae NB+HodBRykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwETWTWBkmHpVSHH1rNlMc0p9 5RgdFFeWRjlP59YzjNKfo6EZkmH4leEPv3zstoTb4mx68UWJs1p3vJfxZV80+fINffVn22+KWzb zAwA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 This validates the previous commit: the userspace can set unknown flags -- the 7th bit is currently unused -- without errors, but only the supported ones are printed in the endpoints dumps. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 4 ++++ tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testin= g/selftests/net/mptcp/pm_netlink.sh index ec6a87588191..123d9d7a0278 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -192,6 +192,10 @@ check "show_endpoints" \ flush_endpoint check "show_endpoints" "" "flush addrs" =20 +add_endpoint 10.0.1.1 flags unknown +check "show_endpoints" "$(format_endpoints "1,10.0.1.1")" "ignore unknown = flags" +flush_endpoint + set_limits 9 1 2>/dev/null check "get_limits" "${default_limits}" "rcv addrs above hard limit" =20 diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/= selftests/net/mptcp/pm_nl_ctl.c index 65b374232ff5..99eecccbf0c8 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -24,6 +24,8 @@ #define IPPROTO_MPTCP 262 #endif =20 +#define MPTCP_PM_ADDR_FLAG_UNKNOWN _BITUL(7) + static void syntax(char *argv[]) { fprintf(stderr, "%s add|ann|rem|csf|dsf|get|set|del|flush|dump|events|lis= ten|accept []\n", argv[0]); @@ -836,6 +838,8 @@ int add_addr(int fd, int pm_family, int argc, char *arg= v[]) flags |=3D MPTCP_PM_ADDR_FLAG_BACKUP; else if (!strcmp(tok, "fullmesh")) flags |=3D MPTCP_PM_ADDR_FLAG_FULLMESH; + else if (!strcmp(tok, "unknown")) + flags |=3D MPTCP_PM_ADDR_FLAG_UNKNOWN; else error(1, errno, "unknown flag %s", argv[arg]); @@ -1048,6 +1052,13 @@ static void print_addr(struct rtattr *attrs, int len) printf(","); } =20 + if (flags & MPTCP_PM_ADDR_FLAG_UNKNOWN) { + printf("unknown"); + flags &=3D ~MPTCP_PM_ADDR_FLAG_UNKNOWN; + if (flags) + printf(","); + } + /* bump unknown flags, if any */ if (flags) printf("0x%x", flags); --=20 2.51.0 From nobody Sun Dec 14 06:34:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4A03E38C965; Fri, 5 Dec 2025 18:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960939; cv=none; b=jbC9A6hdCAnEnEsPh92Z9HHvwH67Xo7PrZnw4X3AFB8sZBFrN0f0eV/stPluF8o4bgiwqBM7fai0p3Z7VZOB1M3oqtg5NgoabzEUH0pAHGqqW0/CBKtG+UvFawhsEt8dZ1KpvQsqeB60PhRi5ZDhZyZnRLdwumTkK/lX0fWlIkY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960939; c=relaxed/simple; bh=LBGJ10NGm/7i5Fc6PC0h0738AWnQFDymUI8BVZwe1ng=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n/TE2Zb6uUysiqPwroSwfhTflVQI1Iw6gs5Jy7O6EyETCgcmZ/s0+d2/eDPw925sIrYXy/McN2iqgPZXWP7hbV6PCwKtWiJUCPzoUE+PUDQBwj6Yx7uN4XYqpnQ5s/XC/2mzXT3VCYMirOzFgGCP3FGAKX8rqO3rkLIpdhZNBw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QeLNN2aH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QeLNN2aH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 844E8C116B1; Fri, 5 Dec 2025 18:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764960939; bh=LBGJ10NGm/7i5Fc6PC0h0738AWnQFDymUI8BVZwe1ng=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QeLNN2aHuqPcDcSKao4sg/t7MOtKD/8gke9z3q/bW9xylX8p0rCrhYlcdHgKy94JP 9RwSYVf7MR2Glb3vTE79Np007JFOPxVpBoCqd/ZRo1Ph2/LYP5jwhAvQC4AlC53fXT sOK0oECLO1A2Ut2mHgrDTApGiLF9t75U7NE4O9XyRAR/JP865tUKhuf1KctpnHH6/b oTpRp6XuLcTYJCA88H5QlkyoLVFwkGoqow1HRzgs/E3HHuGE8DA7DuA9alhszbHLgS 0bWFl8uwalfpS9Y4f6uOWk09iyGmnB+Zr5NtiHJ/HrLw6p9QFl3UsaHL7a5xM+rPv5 S/vv56K2JbGbw== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Dec 2025 19:55:16 +0100 Subject: [PATCH net 3/4] mptcp: schedule rtx timer only after pushing data Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-3-9e4781a6c1b8@kernel.org> References: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> In-Reply-To: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , Kuniyuki Iwashima , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2121; i=matttbe@kernel.org; h=from:subject:message-id; bh=RKCyTYaihj0DTuxY9L2L/+KtoO/PTG2GYNXSf8p2Bjc=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKNtebWKffturdj4c/p/OcreBp+37/z5qdy+qKmz5O2T z/gXqLN01HKwiDGxSArpsgi3RaZP/N5FW+Jl58FzBxWJpAhDFycAjCR0hOMDKvlYzQ7Hm3mTm6I 3nnowAnBWJ9n3ZGKCw48OrI2YfLPdVoM/wyWtL7+fczDfoFV/ZkpKZNmCR67+ONt21bleoFV/Uk H3TkB X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Paolo Abeni The MPTCP protocol usually schedule the retransmission timer only when there is some chances for such retransmissions to happen. With a notable exception: __mptcp_push_pending() currently schedule such timer unconditionally, potentially leading to unnecessary rtx timer expiration. The issue is present since the blamed commit below but become easily reproducible after commit 27b0e701d387 ("mptcp: drop bogus optimization in __mptcp_check_push()") Fixes: 33d41c9cd74c ("mptcp: more accurate timeout") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index e212c1374bd0..d8a7f7029164 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -1623,7 +1623,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) struct mptcp_sendmsg_info info =3D { .flags =3D flags, }; - bool do_check_data_fin =3D false; + bool copied =3D false; int push_count =3D 1; =20 while (mptcp_send_head(sk) && (push_count > 0)) { @@ -1665,7 +1665,7 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) push_count--; continue; } - do_check_data_fin =3D true; + copied =3D true; } } } @@ -1674,11 +1674,14 @@ void __mptcp_push_pending(struct sock *sk, unsigned= int flags) if (ssk) mptcp_push_release(ssk, &info); =20 - /* ensure the rtx timer is running */ - if (!mptcp_rtx_timer_pending(sk)) - mptcp_reset_rtx_timer(sk); - if (do_check_data_fin) + /* Avoid scheduling the rtx timer if no data has been pushed; the timer + * will be updated on positive acks by __mptcp_cleanup_una(). + */ + if (copied) { + if (!mptcp_rtx_timer_pending(sk)) + mptcp_reset_rtx_timer(sk); mptcp_check_send_data_fin(sk); + } } =20 static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk= , bool first) --=20 2.51.0 From nobody Sun Dec 14 06:34:15 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2AD838E5E7; Fri, 5 Dec 2025 18:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960942; cv=none; b=olNCERjfKGMAE6vljM3Jg92zPY28mUzH+wtazI0yjQKaSklBpP/3pBlHttheSwxXy8aFVdHAf5NHipA9YHDxScWLbxv9p3cOs2DKA2QIEvEuFmiUNXKg342AoqWN45DLBgIFOgk0q71zlA9k0gornwKFymWCgMzEV5C94P2vS10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764960942; c=relaxed/simple; bh=gi2Av8q3in3QzwEL8x3SFmn1RHNiRmW/7BBWqhhGYtk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HyHHwjBDFvlKheQOgs9S/6UCAR2eRPiuZIbrff36dxLLuhbOo6VxBAQ5oRCW89JaHXJGTelWGRMTfd/CfOoWfu2I2wba5LRQExCbaFV0jDh/2H/sAXGaHR/YRsX1W4g8ss9v6Ph/UGfJZCXsMIB5c6qdmTbDxPVr9uzHEF1MALM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KACfQyHf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KACfQyHf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C91EC116B1; Fri, 5 Dec 2025 18:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764960942; bh=gi2Av8q3in3QzwEL8x3SFmn1RHNiRmW/7BBWqhhGYtk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KACfQyHf7ghJMFg28DBHWF9/CKcMdubF5ZTiZT8DlfL2ws14WclLtta2K5ML0Ssxx LWhTTtfnMEilow1w7b0OOFfxwVZ4TfidSPk9e+2clUbdKXgyLcyAGk8l+vkb+fxeFe zLW+B3ng10Ywg/A7z6cjPlOZy/eTDf8FGKtdlzy6y4HLrYyn1sPowltXzdSKV3XEiu U1kem8PIYihFIZvoxEuzEJ95/JSsFhpZhoBTI8neasB6hap6l/Pwm82wF2dU1BHxuk DW0B0EfZ++gnZPYNHQiyoKDUfFIfIm9xhhuG7e+1c5Ye04Hb9q/6PSR7DKPZdTIgAU qsfV5lf6HrMWg== From: "Matthieu Baerts (NGI0)" Date: Fri, 05 Dec 2025 19:55:17 +0100 Subject: [PATCH net 4/4] mptcp: avoid deadlock on fallback while reinjecting Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-4-9e4781a6c1b8@kernel.org> References: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> In-Reply-To: <20251205-net-mptcp-misc-fixes-6-19-rc1-v1-0-9e4781a6c1b8@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Shuah Khan , Kuniyuki Iwashima , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4072; i=matttbe@kernel.org; h=from:subject:message-id; bh=zSolF7dynwE7ZM3RMnnQOzle4tFTXVJK06AkU0eCkGY=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGDKNteb9dtvzUmOWzqLpv8/O+6QhtiTx/tKr++Vktvn/l zosL5F0uKOUhUGMi0FWTJFFui0yf+bzKt4SLz8LmDmsTCBDGLg4BWAijTKMDC8yb5z+paBepMj0 3/rAgoarU9dEuivsjZ+3uuf1n3dZexMY/mlxvHyav+L64cDUsAMLDmiV7sywOvb99fubjqvaz0y K1mcAAA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Paolo Abeni Jakub reported an MPTCP deadlock at fallback time: WARNING: possible recursive locking detected 6.18.0-rc7-virtme #1 Not tainted -------------------------------------------- mptcp_connect/20858 is trying to acquire lock: ff1100001da18b60 (&msk->fallback_lock){+.-.}-{3:3}, at: __mptcp_try_fallba= ck+0xd8/0x280 but task is already holding lock: ff1100001da18b60 (&msk->fallback_lock){+.-.}-{3:3}, at: __mptcp_retrans+0x= 352/0xaa0 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&msk->fallback_lock); lock(&msk->fallback_lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by mptcp_connect/20858: #0: ff1100001da18290 (sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_sendmsg+0x1= 14/0x1bc0 #1: ff1100001db40fd0 (k-sk_lock-AF_INET#2){+.+.}-{0:0}, at: __mptcp_retra= ns+0x2cb/0xaa0 #2: ff1100001da18b60 (&msk->fallback_lock){+.-.}-{3:3}, at: __mptcp_retra= ns+0x352/0xaa0 stack backtrace: CPU: 0 UID: 0 PID: 20858 Comm: mptcp_connect Not tainted 6.18.0-rc7-virtme= #1 PREEMPT(full) Hardware name: Bochs, BIOS Bochs 01/01/2011 Call Trace: dump_stack_lvl+0x6f/0xa0 print_deadlock_bug.cold+0xc0/0xcd validate_chain+0x2ff/0x5f0 __lock_acquire+0x34c/0x740 lock_acquire.part.0+0xbc/0x260 _raw_spin_lock_bh+0x38/0x50 __mptcp_try_fallback+0xd8/0x280 mptcp_sendmsg_frag+0x16c2/0x3050 __mptcp_retrans+0x421/0xaa0 mptcp_release_cb+0x5aa/0xa70 release_sock+0xab/0x1d0 mptcp_sendmsg+0xd5b/0x1bc0 sock_write_iter+0x281/0x4d0 new_sync_write+0x3c5/0x6f0 vfs_write+0x65e/0xbb0 ksys_write+0x17e/0x200 do_syscall_64+0xbb/0xfd0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 RIP: 0033:0x7fa5627cbc5e Code: 4d 89 d8 e8 14 bd 00 00 4c 8b 5d f8 41 8b 93 08 03 00 00 59 5e 48 83= f8 fc 74 11 c9 c3 0f 1f 80 00 00 00 00 48 8b 45 10 0f 05 c3 83 e2 39 = 83 fa 08 75 e7 e8 13 ff ff ff 0f 1f 00 f3 0f 1e fa RSP: 002b:00007fff1fe14700 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007fa5627cbc5e RDX: 0000000000001f9c RSI: 00007fff1fe16984 RDI: 0000000000000005 RBP: 00007fff1fe14710 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 00007fff1fe16920 R13: 0000000000002000 R14: 0000000000001f9c R15: 0000000000001f9c The packet scheduler could attempt a reinjection after receiving an MP_FAIL and before the infinite map has been transmitted, causing a deadlock since MPTCP needs to do the reinjection atomically from WRT fallback. Address the issue explicitly avoiding the reinjection in the critical scenario. Note that this is the only fallback critical section that could potentially send packets and hit the double-lock. Reported-by: Jakub Kicinski Closes: https://netdev-ctrl.bots.linux.dev/logs/vmksft/mptcp-dbg/results/41= 2720/1-mptcp-join-sh/stderr Fixes: f8a1d9b18c5e ("mptcp: make fallback action and fallback decision ato= mic") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index d8a7f7029164..9b1fafd87cb9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2769,10 +2769,13 @@ static void __mptcp_retrans(struct sock *sk) =20 /* * make the whole retrans decision, xmit, disallow - * fallback atomic + * fallback atomic, note that we can't retrans even + * when an infinite fallback is in progress, i.e. new + * subflows are disallowed. */ spin_lock_bh(&msk->fallback_lock); - if (__mptcp_check_fallback(msk)) { + if (__mptcp_check_fallback(msk) || + !msk->allow_subflows) { spin_unlock_bh(&msk->fallback_lock); release_sock(ssk); goto clear_scheduled; --=20 2.51.0