Article View: linux.kernel.netdev
Article #17474[PATCH net 7/7] mptcp: fix dummy mapping of overlapping segments
From: "Matthieu Baerts (NGI0)"
Date: Mon, 16 Nov 2026 22:06
Date: Mon, 16 Nov 2026 22:06
77 lines
12227 bytes
12227 bytes
From: Geliang Tang <tanggeliang@kylinos.cn>
An MPTCP socket that has fallen back to TCP can silently lose received
data if a segment partly overlaps data received earlier, and recv() then
blocks, returning neither later data nor end of file.
After a fallback, subflow_check_data_avail() makes up a dummy mapping
for the skb at the head of the subflow's receive queue, in which map_seq
and map_subflow_seq must describe the same byte. But since commit
2834f8edd74d ("mptcp: cleanup fallback dummy mapping generation"), it
computes map_seq from the first byte of the skb, while map_subflow_seq
is still computed from copied_seq, the next unread byte.
mptcp_subflow_get_mapped_dsn() then returns the data sequence number
(DSN) of the first byte of the skb, instead of the one of copied_seq.
These two bytes differ for a segment that starts before rcv_nxt and ends
after it, since TCP does not trim it. mptcp_init_skb() then gives the
new bytes of this skb a DSN that is too low, and __mptcp_move_skb()
skips some of them as old data, leaving a hole in the stream:
bytes 0 to 999 are received, the skb holds bytes 900 to 1499
byte 1000 gets the DSN of byte 900: too low by the 100 old bytes
that is 100 below ack_seq, the next DSN that MPTCP expects
__mptcp_move_skb() skips bytes 1000 to 1099 as old data
ack_seq is the DSN of byte 1400, copied_seq is byte 1500
later data starts at the DSN of byte 1500: out of order
the TCP FIN becomes a dummy DATA_FIN after the last byte
ack_seq does not reach it, so there is no end of file
Fix this by computing map_subflow_seq from the first byte of the skb as
well: mptcp_subflow_get_mapped_dsn() then returns the DSN of copied_seq.
Chris Mason sent the same fix in private, and found this issue with the
help of an LLM. It has been reproduced in a VM, with the reproducer he
shared, and with a new Packetdrill test: after a fallback to TCP, a
segment overlapping data already received is injected. Without this
patch, the new bytes at the beginning of this segment were lost, and the
connection stalled, with no end of file:
reader 30.64: conn 1 BREAK: at my offset 1000 the bytes claim offset 1100: A GAP OF 100 BYTES
reader 30.64: READ-TOTAL conn 1 outcome iii-gap-or-repeat bytes 1400 of 2500 [...]
[...] end: hang: no data and no end of file for 30 s
And with the Packetdrill test:
dss_fallback_overlap_client.pkt:24: runtime error in read call: Expected result 2500 but got 1400 with errno 115 (Operation now in progress)
Fixes: 2834f8edd74d ("mptcp: cleanup fallback dummy mapping generation")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/4c48d016490d43b6892c622cbae858b48f176cff.1794304840.git.tanggeliang@kylinos.cn [1]
Co-developed-by: Chris Mason <mason@kernel.org>
Signed-off-by: Chris Mason <mason@kernel.org>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
[ Combine the commit messages of Geliang's [1] and Chris's versions.
Commit message: how the issue was found, and its symptoms. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/subflow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 00677fb3efcd..6f07544bfe40 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1496,7 +1496,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
skb = skb_peek(&ssk->sk_receive_queue);
subflow->map_valid = 1;
subflow->map_data_len = skb->len;
- subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset;
+ subflow->map_subflow_seq = TCP_SKB_CB(skb)->seq - subflow->ssn_offset;
subflow->map_seq = __mptcp_expand_seq(subflow->map_seq,
subflow->iasn +
TCP_SKB_CB(skb)->seq -
--
2.55.0
Technical Details
Message-ID:
<20261116-net-mptcp-misc-fixes-7-4-rc4-v1-7-bf7656de653e@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364755-linux-kernel-netdev=dewy.ruReferences:
<20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364755-linux-kernel-netdev=dewy.ru
From: matttbe@kernel.org ("Matthieu Baerts (NGI0)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 7/7] mptcp: fix dummy mapping of overlapping segments
Date: Mon, 16 Nov 2026 23:06:14 +0100
Organization: Usenet Network
Message-ID: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-7-bf7656de653e@kernel.org>
References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network; logging-data="2178964"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7JvI5hqBT4fOkcTDkocFDnu2RhM= sha256:lbiLSdbVLCRxRQxY2MWOmU/xFFT6JdwUbi3h53KOw3E= sha1:/vWIGXwYKeaINafi0Y9UnxYBC4M= sha256:7sav5vRJ68jZMJ1nUyElROHXAfSumGfIkfw3Io0eGRw=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 626D6114D74; Tue, 17 Nov 2026 01:09:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B0Aeimrkhxm0; Tue, 17 Nov 2026 01:09:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-364755-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 4C346114D85; Tue, 17 Nov 2026 01:09:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 70C55601DE1; Mon, 16 Nov 2026 22:09:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794866948; b=CqZ+fw4dg5fCLeJtUBdofqAZp4bx5mJ3c6sycuuRymcuy0NzdbduF6z1p2C7DktAqdyt cQ/PcK+2SBFYgxpcZ20fTdIm4glKUGrYguQkJ8Maous5J9+fuiVYEBynU5huV0/WlYK3h C/JN03zb30fusznoLxP3z2sG0IKSugmeuaqqALejpi1WdTbV6MIQhML4mrbptxafYvrO7 KyAH0uBG6vHklMEPn2NvCdNdbRIntx2w94C+ChAEH3zS4cIndeh9G8+LcakZboTU4rLFI xFROgEqvGxPtrPPne7Pe0ecpYQIyF0RYf8j9xDIvovy4a4ywh1yzissLhGWsOrYGq5g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866948; h=X-Original-To:Received:Received:DKIM-Signature:From:Date:Subject: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=1S2JG0K8dQlVY7uMvfgeH0EUxwYxdfh4NPdqZIEsOw8=; b=DPB4MwYoY8/U9hchzSxUgf1tu8ysV3HBUbUWJuddrDhp08wizgHCNEFuJKHpsPkV/uQs AGRD0UaqwC/na3x0J6ORHQK0T+IH2L5mH4nvjYMU2+k/gd8XEegSjGqpNPcaWx1Y7Td2g c4IUsw1xo5POuLx06z9KdLfH9Coh3f3lCaSBlUk1gcnKRBcXW5rnb2P6cZdO+zjoiQgt/ kO/0goo6E/qCnTlRZNJK21mXRGOGPR+mjlWN7oeHU6k9+1cibfeG6RLEIZ93ofXkyDZmZ j9hggaB/Jp2rclvQHrWafXB0mM5ZRmp3p/qTeokhT36twAyqBUhMvG5Mhi/H1ljOjug==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gzdAzHls; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1058760A5BC2; Mon, 16 Nov 2026 22:09:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gzdAzHls
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866947; b=5gXKwJatX3ampyC8bxYvsIimqIK0DtYiiUAAsuXrNC6NO3XAigHfZdEiz6IVEDaHMvis sjDQdaTb80X9CB4zz5oF4AFD64oPdDwHPr7PinjokDk6nAG0SrZJxfChOibMBVmdatPe2 ilAG6ZIQNFXH7ALiTPk4PL0Cy8aLp4HR9kR4yg/XnjEOS0XuRqQVI5UETtjSSCZYTsNS9 e0Oy2DhsC/lJoyrcdB+kS/7HYFSkPzfzYyXlJrpeGpQCI6xbDVVU/t/uoD6SaVMhPt1fv 0KjUQB74zO/Mmc9P/jnSgmEkbJyXk9utHiYT3qJMaodVMDxpkWBwNraOvttLC4JGBRg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866947; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=1S2JG0K8dQlVY7uMvfgeH0EUxwYxdfh4NPdqZIEsOw8=; b=C6WRoopyuZqGgTwt0s7TTWhU1Ux1jpGNb7AbEx1nMxn/Oay+XVoO/srODG2BlEMloqSN NyWyAB3qDB0sMLBTWgr+U0LjPrGW/7B2sgBhY2j0W/12UGCWxYumUvaTjpsYXV7lMrPEv 7Ar4rWIMHNiSuX1y5KJhm2X5xm4CABBly/NQWHrcs7lYl+4GuIwwp/VIwMrxRT4nLbuNy 8HjfNhFLhrdm9Yqc01wUfym6mvFCQPHXo4/EBJV335v83ZTpjRflr2W2s2L93n0PFPkuf Chw/AlHCaSYtuR3oTQKqFkhKKQfnXvtrsqqSrxHvWWrzjSq0DDfCaneMWMLfhxGHTng==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gzdAzHls; arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3242E606A887; Mon, 16 Nov 2026 22:09:06 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6651F000C4; Mon, 16 Nov 2026 22:09:04 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866946; bh=1S2JG0K8dQlVY7uMvfgeH0EUxwYxdfh4NPdqZIEsOw8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=gzdAzHlst/oVpS2s52CTsRAoa5D07MLUNCHLzFdWrKucjLubUDdeskYoYJURjWazw L3boWOY4zd7fFouLxIG3xRnJ2N4puO/xi682567esA27euPBYW22iTr/YvOBd4NMLF AQEF9jHvz7PDJNynNyLtb2Go3K7DqFaA8xfaM1m0z6FwEmH/ltJ2dU8o+9wjqG72Az 95kjOaC4dVv3Y5F5II7wLilSvp0MsUDZw+qR/OaZLwd0y8WEic8vhLrsdyHvQDmjUC a12wEPm4OjK1+49nAUNSfIC0qazDuSCMSe0G+pR18OBL2kg5elzOIR/qPV5Er5RGYg zr/6KOnDtqrmA==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org>
X-Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, stable@vger.kernel.org, Chris Mason <mason@kernel.org>, Geliang Tang <geliang@kernel.org>
X-Mailer: b4 0.17-dev
X-Developer-Signature: v=1; a=openpgp-sha256; l=3846; i=matttbe@kernel.org; h=from:subject:message-id; bh=cZPOlHWTnOxbxMx5o66RJt82bkh/T4a/OuHPb6biV0g=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+170K8mA6VbLamnGrkQnDZYE/W5XW5nOwv1204/F3z nleU9cc7ihlYRDjYpAVU2SRbovMn/m8irfEy88CZg4rE8gQBi5OAZjITT6GPxxS+TPv8658373f s7DLK7H33yHuD/zsy8/pemYsmtfQMZ/hv9faeRss84vu7j28jMdT9fpGjTCXtg22infvM607sqL pLBcA
X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073
X-Received-Bytes: 11941