From patchwork Fri Jun 7 15:01:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13690349 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 B48301993AF; Fri, 7 Jun 2024 15:02:17 +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=1717772537; cv=none; b=MkvJm62eppR6USTU7/8z/u063sYdVqng9imPOhCAsf8WDqNZFZF3HpHyT09QWoO0nmzanYtTN+XLt10Y8HRxUVOals7fH5HKXM34l/jMoOH6vL6KykKTd0INqlCGCdSw1mENbjf47S8337ly9SVOawIqCcBSespRZQT/4qy38ag= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772537; c=relaxed/simple; bh=pYJNoB2u1ZqMObb+gIcRRwqEKrEEAYdKPGc5UfseMP0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZnuoIr7HlHZyZOQUd0OMHqU3YzOi4wGQm1WN7Q81fxCKqVNi2ro5zv5W0tOEj9J3THt9BB+qxsumJk9FoyibTdNRkjNbtmuNecwagHTTytGTWkTHL7vHJPkw4JPLrip4F3usLYs8lmUBI3//W4S55Z01wLvrqhJyHP9M9fUxY0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M3dtdi9m; 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="M3dtdi9m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56597C3277B; Fri, 7 Jun 2024 15:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717772537; bh=pYJNoB2u1ZqMObb+gIcRRwqEKrEEAYdKPGc5UfseMP0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=M3dtdi9mUjtm8N+238H1NcPMhSbL/RJ4OT/Mtk4Bf40zaC2jIx+defBoaMm2w+w3F +2ttwNmWnkzd/fgyV1jru7JDsEtQISv0Q5lpDLP488zB1C2/V1q6Q6TbSgS2/z41+j fDMGDwTEDk4J1ggdSTLyaHbh5A+ndfu6L2xgXle4Fo3+Rk3ZrKwxq53DO1jWFojqCv ig02H9ipxPHI8z38s6DWekIciYu3Mx+X3+GRBnjPHnPbR7OSZkrCnMWCkME/xEzrpy C6yDcSrYje4AabCNg8eLbQf3x9P8nz9G+3feVyqasqgPbvfp3nyaR/Mmd934NyTDa1 GHYm1ww6tsaWA== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Jun 2024 17:01:48 +0200 Subject: [PATCH net 1/4] mptcp: ensure snd_una is properly initialized on connect Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240607-upstream-net-20240607-misc-fixes-v1-1-1ab9ddfa3d00@kernel.org> References: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> In-Reply-To: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Davide Caratti , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Christoph Paasch X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1392; i=matttbe@kernel.org; h=from:subject:message-id; bh=PfdPd1CZLVPmAQl+1xZ78iEyztMBE+4I5rQY3Km+0kE=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYyDy6NeVsQvpbGo14NOqTZi/PfttbvDw/or7B hL5j/ruY1GJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmMg8gAKCRD2t4JPQmmg c1dcEADORAJ4oXPVG4UPn9w/yCDwvL5Fyd1gVVSuLXaU6bLYhCcxscq7nRW/KKAjR3D7NGTLSCV HDGYFThEosOr3CzqqcDSco5denpV3jews85JNm1q8/bYhpCKRRSGXqf4gWVs49NzRnBaGAWDJ3W k3iEOzWfcPkjKILeb0mkIawct8pfi6QoYraMFy3Dsd7S51K/egDbNIU6f/9qTBDJahbU0u89Kz5 Z5TJvPVMI7ge88KQTDO2tk5wt9b71JeB0ltY89pqc+nftvC8qDnVgfeIr5BtktmjsSj5s41Wmpq cCDKxW2uZQqtBvvYs/NtWmFpP8RtiY0pv8cFS7lUK2KYHVW5SkoYbJomEZU/Bu1Dw3giQxdSkkT 6RPDWSNucwJ56LbnxELJojvW8djN1Jm+ugL5RKzvP6h4FHn0fJ7KGp5FeaZ1YXpdkxw4X1HoEiv G6IdV3l1lbAd69Fk9X0431biHR2HAHiX5V9jJlBxd/a++c1CeDUdEPBKQglvpz7KoMS1z5yYv8V DaVrPtbpNMcDdr1OOc0Ot8cFKuijXfvblPCghooMmxZP/0ZWy/rJOYgE4pp4zcxLD1Ckn6RfYsC oCPULTeG8HbENfANDylqni4MOTCHVe5dEjSxMjrgmThqqVK1dw/qBPvig20nMOXA0DbbEDogXfP jscIz7Ifr2RS1/Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Paolo Abeni This is strictly related to commit fb7a0d334894 ("mptcp: ensure snd_nxt is properly initialized on connect"). It turns out that syzkaller can trigger the retransmit after fallback and before processing any other incoming packet - so that snd_una is still left uninitialized. Address the issue explicitly initializing snd_una together with snd_nxt and write_seq. Suggested-by: Mat Martineau Fixes: 8fd738049ac3 ("mptcp: fallback in case of simultaneous connect") Cc: stable@vger.kernel.org Reported-by: Christoph Paasch Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/485 Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 96b113854bd3..bb7dca8aa2d9 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3740,6 +3740,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) WRITE_ONCE(msk->write_seq, subflow->idsn); WRITE_ONCE(msk->snd_nxt, subflow->idsn); + WRITE_ONCE(msk->snd_una, subflow->idsn); if (likely(!__mptcp_check_fallback(msk))) MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVE); From patchwork Fri Jun 7 15:01:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13690350 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 D981219A29C; Fri, 7 Jun 2024 15:02:20 +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=1717772541; cv=none; b=dE4WRPqrUcfEIDy4rWKKLdRHqZs0oUHTUuuirBQf8H8q9gZhSGB6IGyWS1+QdfObelW07wR2zR34sYobrOGShIN5f5HDmjTUFW8fx75yVBxstYh/CRh12B7AgbtrPtjUhgdYj/YcqE3cyTF5Cvfev1D7Fqp4u6LNzITXwI0YlTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772541; c=relaxed/simple; bh=PdAmS14wYt04sZq3D7slEkvvAc2hZaFIxiprMU3aay0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GSzbZzOmhxBoK2bzG9oth3b+DpqJYNvu02ScJqee62De3jYMIZwCBSGtDzpW03w7xmJvslI9aQjsFnsH+uhmyGXLYH5XUYnWr7QuKJmKBAPtuzKXdNWAunY+eeeRCf72p8Cbu/vLL/O9Fk8BNA6PqMnn8NBjWlOWOrbYiltf5y8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MfkX7den; 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="MfkX7den" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F52C2BBFC; Fri, 7 Jun 2024 15:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717772540; bh=PdAmS14wYt04sZq3D7slEkvvAc2hZaFIxiprMU3aay0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MfkX7dennpJE3Sevhj7wlY4f93e5y5wvIFpVCIkqlRtleHIaF95cACiyy815GawXw J2SSYW3PJsmNswfPGLFlTq+Qk+3fJEQtiVOGhg2hHL/PGSq0BeMhs67kwS4NHgTJsD Y4Z22goR8MrgNunpqfg1PM3UhRPJ/bkX6epmqdXgGK6ObAsn4bYz4y4mbkx0CTot5B NrrASQYBCM5cfttvrZkopXdaeZgxov+prB9qS4jyOOx/Z5aL23sDdr5up02S3zGveZ cvDddgSicwH7qkEbbTRm+kUCgCGwbbCJattXXiEGguxv0wzazP7jlV0D92ip0LTYEx 1kmFfQ0ptAtag== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Jun 2024 17:01:49 +0200 Subject: [PATCH net 2/4] mptcp: pm: inc RmAddr MIB counter once per RM_ADDR ID Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240607-upstream-net-20240607-misc-fixes-v1-2-1ab9ddfa3d00@kernel.org> References: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> In-Reply-To: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Davide Caratti , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , YonglongLi , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2693; i=matttbe@kernel.org; h=from:subject:message-id; bh=vskkHulrdgn06drgT20DEc3iXN5Qcro4k5QxgWRyi1A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYyDyxzSimTQcaOf36yFil4cqcwxMlQ007Ugvr dXf8D5lo6uJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmMg8gAKCRD2t4JPQmmg c1pgEAC5ALWisx1OLrpLfqqmswMAcusSPKKm4OhLLhYyC1bJk9XBRZis2CYoXGE3GoT0HUNc6gf JMybcBJpJPzL86YY5S/urKrHacXBSQD7HMZups7Wwq9AD8H3Tj+U/7R5bpk4+Gm+pt+P6gJGVF0 jD5UOF6xWYCC6nPcIiXv3LQnUtuUE8Jxt72WmtQqSnk29Y+Sio6m3IRwRgMeTYXCAGVbAcKt5I5 TespSw+krbRqrvw4OHPf6pY4WRA4QI9NlV1BGRgg8YAIxGd7Dxw/eMeEKcxsYcquxeB2Teee7Wj MOjANIrASiPsndkI4nRPCyTI0ggxB3E1tP8dntMp+r2TUbjzeGC2TCpn2M2c9Z46SlNgsCnai9x PH2ZTytIGoiSRgv9AQzOjSXMoDw3zbBgXQzsts6Lf4BgS5akqy2bUm2gk3OMMNd/VUjasPFDBZV ncc0yTUV+UdlqZdDSF0+WGRY9jPy6kazJhkgo1N5ehbepJYLV3cwEz26Kl1Mtr8WyRmpMOo+sbV 7Jc7PyJa+YKdum1xOK5MDTkCIFLmOY6PFmvw1G3zms2zGSNqDiWIKwkPNjAYanm7IIxYvBgVeXN GORuYjKmJ72FPAE5G3ZdY1i78Tl0WTZCPWEkZTrunj/bSZ7R58YVeP9k/p53u1TYVazcc/oVqXQ ZZ5rgQzuaZZQxuQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: YonglongLi The RmAddr MIB counter is supposed to be incremented once when a valid RM_ADDR has been received. Before this patch, it could have been incremented as many times as the number of subflows connected to the linked address ID, so it could have been 0, 1 or more than 1. The "RmSubflow" is incremented after a local operation. In this case, it is normal to tied it with the number of subflows that have been actually removed. The "remove invalid addresses" MP Join subtest has been modified to validate this case. A broadcast IP address is now used instead: the client will not be able to create a subflow to this address. The consequence is that when receiving the RM_ADDR with the ID attached to this broadcast IP address, no subflow linked to this ID will be found. Fixes: 7a7e52e38a40 ("mptcp: add RM_ADDR related mibs") Cc: stable@vger.kernel.org Co-developed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: YonglongLi Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 5 ++++- tools/testing/selftests/net/mptcp/mptcp_join.sh | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 7f53e022e27e..766a8409fa67 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -814,10 +814,13 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, spin_lock_bh(&msk->pm.lock); removed = true; - __MPTCP_INC_STATS(sock_net(sk), rm_type); + if (rm_type == MPTCP_MIB_RMSUBFLOW) + __MPTCP_INC_STATS(sock_net(sk), rm_type); } if (rm_type == MPTCP_MIB_RMSUBFLOW) __set_bit(rm_id ? rm_id : msk->mpc_endpoint_id, msk->pm.id_avail_bitmap); + else if (rm_type == MPTCP_MIB_RMADDR) + __MPTCP_INC_STATS(sock_net(sk), rm_type); if (!removed) continue; diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 2b66c5fa71eb..aea314d140c9 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2250,7 +2250,8 @@ remove_tests() pm_nl_set_limits $ns1 3 3 pm_nl_add_endpoint $ns1 10.0.12.1 flags signal pm_nl_add_endpoint $ns1 10.0.3.1 flags signal - pm_nl_add_endpoint $ns1 10.0.14.1 flags signal + # broadcast IP: no packet for this address will be received on ns1 + pm_nl_add_endpoint $ns1 224.0.0.1 flags signal pm_nl_set_limits $ns2 3 3 addr_nr_ns1=-3 speed=10 \ run_tests $ns1 $ns2 10.0.1.1 From patchwork Fri Jun 7 15:01:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13690351 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 83E7319AA65; Fri, 7 Jun 2024 15:02:24 +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=1717772544; cv=none; b=QKH3XaEdlinZ+HBAjgL/Dj7blRvTOD3leoHEqsCm+g6mZ4TAbbTyYNsZP8/2A/VHGMPCzKnm5q6dLZPCAN/N71N7myr6GSSh+QM8FEfrDL3j3W6uWagOGVLhypuwWf+MhO6ddxtW+v14DZZ3y1KSiGoJxxuOkCAUpRZlGspDTIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772544; c=relaxed/simple; bh=8tlUhkdVvZTcWOukF/NW3k0yzLel5AlJwpWFwZu6gzs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jgy/jPUqDg9uNSPovp0BtX35M333hHo45z018cSuhwvyUDWl0cDEcis1e2+llWh5vRWB3yS6XFiPN6efoWU2S+QZVl0qFX1k7+67RZJrhmBfUKf3dK/+RqaqHcXcljNxKjgCXOwkTwnwEhBLTP8C5oKXC4Sh2hZ/FdYLNuqqz2k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sg1kMVgT; 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="Sg1kMVgT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 369F9C3277B; Fri, 7 Jun 2024 15:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717772544; bh=8tlUhkdVvZTcWOukF/NW3k0yzLel5AlJwpWFwZu6gzs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Sg1kMVgTwMXjYpwi5mRNtHmrDYrZLnxgCB4A8KTAtmshKpTodpOy+YecwmEFQ7/jZ HX2UjoaeOZEpryiYjTneK/c0hu5CHZHa8wcic3qWGbLkDuyq90njh7Ui8PN7rVjfpb q26PBwXPQkX2eYPPfT5JcTKXMCPGkubfF1p0/ikBRKB1Mjc72QorxxhF2vCXPi3RZ+ SqzNRg21AqLshBNnxXxzcg7/N2NaoNti+W/fHBlkvUISkfc888kBq+l6IqAweNisgi ulwMgZ3UAPTuy4cPjhTI7vA7RGwXl9LWg1ZhLGBukY/DD6Qd1fKeeUntAQkCBHYJqo BRO0BfRfgxQ+Q== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Jun 2024 17:01:50 +0200 Subject: [PATCH net 3/4] mptcp: pm: update add_addr counters after connect Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240607-upstream-net-20240607-misc-fixes-v1-3-1ab9ddfa3d00@kernel.org> References: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> In-Reply-To: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Davide Caratti , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , YonglongLi , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3982; i=matttbe@kernel.org; h=from:subject:message-id; bh=zuXyd/+by14MmL5k443XIsgq2Iec/EOQmFET7b08UhY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYyDyeZUx4kMdg4+lvbY3f/ebVuYWN8NXlYzYu 73X2AE0OfOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmMg8gAKCRD2t4JPQmmg czDeD/0Zf0M1V9mn2bjRhdU2EBrWLIH3EHax9QERfZSsc8q8SZQS/3VLgFnqInFAlFtGkBOavV1 kawZ1CRrdmCZ2UXpS3kAFePbhHc2/b2hWUlDlQyXvnwAjDfh5/jefCXa5G53salv9t8ujbg/Jir RHK8YqF1LqMUDcAxRXPexVLh4mcUyr1TVaq3HRqoHx8Dp5GgokQ7N8QifViAEO1Ka9/4ZOu0rsE n+l7qElW5stYlyFG0OdIN8XhbC7DOT0HVsL5EmRzh+TEvgTj8nRQmLbwl0yw+dEAflwLJiCv1il d1YkfSo+P3em+YcjEDVG1S4xPKjt7FmuDYnLhaAotaRVn/eF17bQx9w7k94fI89g/262/eyczrR AV4jn2Fo4El0NoZNtOYLZL0hl+GZyu7h9MEp+JM7SQPw2RDaP0E5MOra/DSZq8ETFcZ1j0G4hYO S3YQbJFXM5BxAb3QBsvhIIlleDx8FOyqiA7wTC+M9e+GvxfIVAQjxBFKhNifgmnNAtgT17Ykfbs +nnjmoTcyhW46NnoHK8tEaNvxpF5n43e8j1vtRvZyzbOPkh1koL3gD+mEBln6h+P0EU49rJaywF aLdPGNmH8vbg5JeE0TsgS2P4JJ/Da6FFNVq/udwku6RNRwPPEWvzJkty670jjqfZSFpLON4QYQZ BUmFV/91p6DTrVw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: YonglongLi The creation of new subflows can fail for different reasons. If no subflow have been created using the received ADD_ADDR, the related counters should not be updated, otherwise they will never be decremented for events related to this ID later on. For the moment, the number of accepted ADD_ADDR is only decremented upon the reception of a related RM_ADDR, and only if the remote address ID is currently being used by at least one subflow. In other words, if no subflow can be created with the received address, the counter will not be decremented. In this case, it is then important not to increment pm.add_addr_accepted counter, and not to modify pm.accept_addr bit. Note that this patch does not modify the behaviour in case of failures later on, e.g. if the MP Join is dropped or rejected. The "remove invalid addresses" MP Join subtest has been modified to validate this case. The broadcast IP address is added before the "valid" address that will be used to successfully create a subflow, and the limit is decreased by one: without this patch, it was not possible to create the last subflow, because: - the broadcast address would have been accepted even if it was not usable: the creation of a subflow to this address results in an error, - the limit of 2 accepted ADD_ADDR would have then been reached. Fixes: 01cacb00b35c ("mptcp: add netlink-based PM") Cc: stable@vger.kernel.org Co-developed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Signed-off-by: YonglongLi Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 16 ++++++++++------ tools/testing/selftests/net/mptcp/mptcp_join.sh | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 766a8409fa67..ea9e5817b9e9 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -677,6 +677,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) unsigned int add_addr_accept_max; struct mptcp_addr_info remote; unsigned int subflows_max; + bool sf_created = false; int i, nr; add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); @@ -704,15 +705,18 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) if (nr == 0) return; - msk->pm.add_addr_accepted++; - if (msk->pm.add_addr_accepted >= add_addr_accept_max || - msk->pm.subflows >= subflows_max) - WRITE_ONCE(msk->pm.accept_addr, false); - spin_unlock_bh(&msk->pm.lock); for (i = 0; i < nr; i++) - __mptcp_subflow_connect(sk, &addrs[i], &remote); + if (__mptcp_subflow_connect(sk, &addrs[i], &remote) == 0) + sf_created = true; spin_lock_bh(&msk->pm.lock); + + if (sf_created) { + msk->pm.add_addr_accepted++; + if (msk->pm.add_addr_accepted >= add_addr_accept_max || + msk->pm.subflows >= subflows_max) + WRITE_ONCE(msk->pm.accept_addr, false); + } } void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index aea314d140c9..108aeeb84ef1 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2249,10 +2249,10 @@ remove_tests() if reset "remove invalid addresses"; then pm_nl_set_limits $ns1 3 3 pm_nl_add_endpoint $ns1 10.0.12.1 flags signal - pm_nl_add_endpoint $ns1 10.0.3.1 flags signal # broadcast IP: no packet for this address will be received on ns1 pm_nl_add_endpoint $ns1 224.0.0.1 flags signal - pm_nl_set_limits $ns2 3 3 + pm_nl_add_endpoint $ns1 10.0.3.1 flags signal + pm_nl_set_limits $ns2 2 2 addr_nr_ns1=-3 speed=10 \ run_tests $ns1 $ns2 10.0.1.1 chk_join_nr 1 1 1 From patchwork Fri Jun 7 15:01:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts (NGI0)" X-Patchwork-Id: 13690352 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 A6C8919AD68; Fri, 7 Jun 2024 15:02:27 +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=1717772547; cv=none; b=A+XU3UhiEFFbRaSan8ZQ+CtAst3E5YsI33zdsqtiRuWxuxQ8EUBq3vKP3+lE/QtrjdsJvvovTVSLdUie6MwpFlmR6fMRyJqtMU+CgLL7ltZ8lfkS1IPSUt6lUjMGUBKPA0mQvFKzirPjmpxlIedbZqQc9jXbzFBBdQ1fiyvEmtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717772547; c=relaxed/simple; bh=cKM7RuuLhFgMfOSpl1D5KVRChq2EXU3zXiDN20uZq1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fJtIXEYNxoXUbRn9VLP41sgoomqgOoojFIiQGaS6MGJ6PrSXmtXGJy1iLjsKd1ZxeRH6s/xRfRof/TTInvL04J3ur42tWr7O30EVJh2MdhMlBueyqeIgxIYuuaxoai7Ayw791rB/N+CaT9LDRpWLpWX2F4rQm5J1n39SuYLzH7c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X32ZPqp8; 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="X32ZPqp8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C620C4AF0B; Fri, 7 Jun 2024 15:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717772547; bh=cKM7RuuLhFgMfOSpl1D5KVRChq2EXU3zXiDN20uZq1g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X32ZPqp8pL3M7UEoem9LcpQpherccDkUfwgMXRgsuqOPQiN7PZD8+vwJHTuMwzjsB th+dnEIKItMTFlgKAoCt9c2fFG5E1jcAoXCvncx/e8d/Kd5Lw3f6Sg/D7ug6e/YwQk DYu+IXhyt7kNNArMbvL9eSlpSPF5GkwuBERw0sPAhzAiAD/Ehx9jP8hgpDTU4eDw79 TZDSWPSPvytDfnzlgZr2GUBACV72cycCn5+Axwig9BTSmASPa3JiLfKC7BnYWyQB6X fzBeVIeKZgQsqkA3SBkbVFxlJp/vhmdHRfsHG9eYAPccbhbAg7FUZ+KjqZp5R23i1D mTNn7Xrb/CcqA== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Jun 2024 17:01:51 +0200 Subject: [PATCH net 4/4] mailmap: map Geliang's new email address Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240607-upstream-net-20240607-misc-fixes-v1-4-1ab9ddfa3d00@kernel.org> References: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> In-Reply-To: <20240607-upstream-net-20240607-misc-fixes-v1-0-1ab9ddfa3d00@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Davide Caratti , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1254; i=matttbe@kernel.org; h=from:subject:message-id; bh=wGAolGEs102WghMQ7nzLMzzJ0ECkA6N6A+zrTa6R6YY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYyDyw/2uP1W59Z1eDvUQwISaJzZPOC18sXrTH fkMMUend7KJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmMg8gAKCRD2t4JPQmmg c9zQEACJtxn7Ps76NavfBl9WiQKM1Js/m/TEgiPPw1GmtPdE0HnnwRJoUBH3vT1euwto9Yh9FJR xgpK+OB9EQOaw+RdyxBN1xoivdn3D0eYfobK0LlH8ZJgdTfirnQ/3AD+QVPACdB2Bm1UAmlk8ZB DMkYE1gFHloTGNQ/yCVlODhP35T1Rm2LmW99qeRDrsSIZSQWNxUSTJt0y9q9VKdNDPWVASl9EgA QlATCd8glOChFVab0Y4HR0oQ/ew54tNx06mgpoeVLoCmFKS95T9FxLXyUQoALD0mB8MATJHaboW njZ1IcEITRi3XIo3q5eqTb1F4VYC9cISz8yoiPsXKwCcuy+ZfU+1p5YyactsKPmXx6/N8Jyl5dR ZiXjN1O9rzFifuIvgQhofX3Sv+njIcpRkfBO6hd/GkEhe6jHa1Rzsia6mN+O71bXQTK+DcSdEY4 MElswUIXBejARdqdUTHhkLXQqH1y3JTNTZfaoZoVbI/hpxNw86q057+eSLNdN4ckE1RssUlPR1r dEfW2sfZDne302UeumIZF/O5Lc0pzsUHvBN+iEPSykzI53mZw6S9dufR6M+YSVqMWnlHUjCQ2eh yoDnxGxqoF/vitap2aj+/T/ltOYgd4bhkqIoD71RXCK5IIXhns1IAr8EX71F0M7tra/vxXrav8k TrRkS7TLkKkQewg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang Just like my other email addresses, map my new one to kernel.org account too. My new email address uses "last name, first name" format, which is different from my other email addresses. This mailmap is also used to indicate that it is actually the same person. Suggested-by: Mat Martineau Suggested-by: Matthieu Baerts Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index efd9fa867a8e..9af91bd3584b 100644 --- a/.mailmap +++ b/.mailmap @@ -217,6 +217,7 @@ Geliang Tang Geliang Tang Geliang Tang Geliang Tang +Geliang Tang Georgi Djakov Gerald Schaefer Gerald Schaefer