From patchwork Fri Dec 15 16:04:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 755021 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 866333DBA3; Fri, 15 Dec 2023 16:04:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="djrQj6zk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FF7EC433C7; Fri, 15 Dec 2023 16:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702656290; bh=b2qibfhtaIVxT4ecOksI8qttwHiTICgitByIyJ3pq9o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=djrQj6zk2JGwpNC82lJx6g5E7NLozuGj2Q2KIGygvZslHuoAhMW1NU8Fh9D/FJAjL CMRql2tcn7+gIhfij0dB1mAEJn9aLNEm+BwOfB4OOVOWa+qswjIx68w7nJvatI/lW8 s4LrSN/FWaCXMOMyGL/Z8VCRs0LtBUOoMFBRkckhQUUyPundahX4kkSr5n+dlR1Pbz QTGCQBgfqA1/famJ2GjchDfZO2PcCrbKqimkH8G0SVN6XKB9aRO5OZSKaMxygetbL4 vUsuwTffPI/xawJMOWhiDYeRVTfBOTWuPcg8vfgl7IPJY9BxvetP8i4dSqXwjst7G5 tT92F7xTBTVbg== From: Matthieu Baerts Date: Fri, 15 Dec 2023 17:04:24 +0100 Subject: [PATCH net 1/4] selftests: mptcp: join: fix subflow_send_ack lookup Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-1-91d20266d525@kernel.org> References: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> In-Reply-To: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Benjamin Hesmans , Dmytro Shytyi Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Matthieu Baerts , Geliang Tang , stable@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3042; i=matttbe@kernel.org; h=from:subject:message-id; bh=4/C0UGMyEKrvP+rHTWk5Iw2oMPY5jJScDwNFrAmbq0A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlfHkbz/qYV/d7mOv4cNUF2I8C5IkF9TpD3mteD R+Oo88pcBaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZXx5GwAKCRD2t4JPQmmg c10+EADunBQlaexJGqXaIYwFQ3kLj0+wR46Q578yCJyFIXiQgIOf38/tgpbpg+E2RI+5RtvOqIm sXlvuW30f0i4T21Sw1uz46iD20cWXe70AkBgIzzZe95RDZNOB4TtmTiCCXjjhFTVj0rSKZntjSJ JEMtnp4hiH6VlQDLt+cL0IYJZVxcFTmFeMrCZ/pSGamqAvOsUHk0TbI9Q44NtW7A40j07x8Iz47 bz6uNRIO32ozEna3eSXTLURRjn1HUy/eU4NzPyhUJjR7SiCdFGDnP1YYH0tQsJEeU4j2v3Jwi4r 3JG7AkSi2x5ig9nG9E/qW15GaEamP+7Y/Yl6CPV5zMVFxJ5BAluVcIzIpFIu1ilidrkBh+XgEVq wribJ7dhmSLS7efV0pqCzm/ldvXyLytjC7yzQI+uB8ESpJwQSFUcohnROEehuzX05UPR+knApQN 7lMFRkhV4DcwwvXGxt0747AhX1epfheJL4zslKcSy6F+L2ksstpxxzNcf/5Zb2qXeWCCcY7rTAU 3s+7DNfHqRAS2Sva7+qphnO5VyhMdLid4kz6IB36+Nbvjhc2bxIBkifE6DWqwxggZIvhAfAy5qd mReqeZh6qRbRoW1QIRuZhyomNibWyWeK1/0OXI5Kzzqsk2e1sASJDcY2SchnN/YoH2N9H6b2Lxz AJKbLBIuauX/zpQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang MPC backups tests will skip unexpected sometimes (For example, when compiling kernel with an older version of gcc, such as gcc-8), since static functions like mptcp_subflow_send_ack also be listed in /proc/kallsyms, with a 't' in front of it, not 'T' ('T' is for a global function): > grep "mptcp_subflow_send_ack" /proc/kallsyms 0000000000000000 T __pfx___mptcp_subflow_send_ack 0000000000000000 T __mptcp_subflow_send_ack 0000000000000000 t __pfx_mptcp_subflow_send_ack 0000000000000000 t mptcp_subflow_send_ack In this case, mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$" will be false, MPC backups tests will skip. This is not what we expected. The correct logic here should be: if mptcp_subflow_send_ack is not a global function in /proc/kallsyms, do these MPC backups tests. So a 'T' must be added in front of mptcp_subflow_send_ack. Fixes: 632978f0a961 ("selftests: mptcp: join: skip MPC backups tests if not supported") Cc: stable@vger.kernel.org Signed-off-by: Geliang Tang Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 3c94f2f194d6..24a57b3ae215 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -2776,7 +2776,7 @@ backup_tests() fi if reset "mpc backup" && - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 @@ -2785,7 +2785,7 @@ backup_tests() fi if reset "mpc backup both sides" && - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup speed=slow \ @@ -2795,7 +2795,7 @@ backup_tests() fi if reset "mpc switch to backup" && - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow sflags=backup speed=slow \ run_tests $ns1 $ns2 10.0.1.1 @@ -2804,7 +2804,7 @@ backup_tests() fi if reset "mpc switch to backup both sides" && - continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then + continue_if mptcp_lib_kallsyms_doesnt_have "T mptcp_subflow_send_ack$"; then pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow sflags=backup speed=slow \ From patchwork Fri Dec 15 16:04:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 754708 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 F3C473EA74; Fri, 15 Dec 2023 16:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rH7286Ld" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82697C433C9; Fri, 15 Dec 2023 16:04:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702656293; bh=SbJwmZRJnGKII1skWIacC7YC3/hu/Au6uzQ1pRctVkM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rH7286Ldh7+X0FbUZBSf1fqMe6RFLBZlNTpVlYRvGNoiZViRalIyx2PrrdJ2U6yV/ aG+/xoHUN3kUZGuX3qoSWRiV1hANr01J+RifN7+cykePQBz1YAT7JneNkHDpbo9sj1 +SEwzARtoRS9OPHv0e/GN0a7yddjKXeo4K9iwki4SsQQ3H/R0v0+PfRZ/syxXKRKYO 5dCESM/ooWletGJCSTARo7qMYLtRJRG3XbtsD9rcfud9tyVjnJvF0q3/1vHm9i6FEG gsIRiZcden5vGQ2mHVrq/feXoOY3CnLwfsxU99SMBEIVMaChzOPiASwbTy+UWpaC1F +7Ds9gCc5zhsg== From: Matthieu Baerts Date: Fri, 15 Dec 2023 17:04:25 +0100 Subject: [PATCH net 2/4] mptcp: fix inconsistent state on fastopen race Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-2-91d20266d525@kernel.org> References: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> In-Reply-To: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Benjamin Hesmans , Dmytro Shytyi Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Matthieu Baerts , stable@vger.kernel.org, syzbot+c53d4d3ddb327e80bc51@syzkaller.appspotmail.com X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=9765; i=matttbe@kernel.org; h=from:subject:message-id; bh=uW+yzMpMnMVNxiJolEoHv36TrMhhDDV8hr1pJusFi1M=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlfHkbHHP2fm9XCiugbpRRIqimrcMM5eG77EraJ iRTubdM2lmJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZXx5GwAKCRD2t4JPQmmg c9kdD/9GdEGxMt6ecfFrxhuHNEYAVBgn8FdoCUx288DqzHgHC6UEqZDi8kp64Ry0czexfspFMgv qiO5dYMEupZlDizu/4rXxZhYyr/5v70BaJAtiudJ8f2BkilBqqDZrpDUapKwmPrysuTwEgy/5xa 6+yYno6HZjERpRUeVPwo8ivqfieR69eVMPEkJCJUIKv3IlghFPQL7AXFn64XWSvpCxXK3R7N7or T8DgRrPBrB8uX0+I3zlG26pOgnRi6cCd1tfTHIeNKQYN/3BFYwX6Kar3h+LeBMg3N7/rEj4spUO TciPC7DDYIMN/azbFX4xjoQz+yNb/gcHQt9+LhdVAEXAN9O1U4/YLZhdPenABjAz6tHK2PHUxLX DLRwUaFTlqpMenPNuzPwuMJjS5vVg9bKTLGhGDHCai06ZyY7p7YPJt9naCYH9i+V+CI0zwPWO4W PmfsmfitCC5ZRLZ+3qtKCDWULc4ns2N2L5NfiZBqhd3VO6P82c8mieLEmT7SkXDBVOQz2eiQOKn AQ63YeoIJVl5LvZUWSjPcXo3cWG4t9sb0hBfYn/xYkWJg3abXO/eeYi+kBXuX8KDBlm0y0Tir4y UfqDOA8WIvjaSy7oW607qLH9vH3Oyrpeqzb8FvFEFjqDR7H15zQsy+RPTqV6y1sKzIT4wIeUSlg OotdtOv65vRbHkg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Paolo Abeni The netlink PM can race with fastopen self-connect attempts, shutting down the first subflow via: MPTCP_PM_CMD_DEL_ADDR -> mptcp_nl_remove_id_zero_address -> mptcp_pm_nl_rm_subflow_received -> mptcp_close_ssk and transitioning such subflow to FIN_WAIT1 status before the syn-ack packet is processed. The MPTCP code does not react to such state change, leaving the connection in not-fallback status and the subflow handshake uncompleted, triggering the following splat: WARNING: CPU: 0 PID: 10630 at net/mptcp/subflow.c:1405 subflow_data_ready+0x39f/0x690 net/mptcp/subflow.c:1405 Modules linked in: CPU: 0 PID: 10630 Comm: kworker/u4:11 Not tainted 6.6.0-syzkaller-14500-g1c41041124bd #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Workqueue: bat_events batadv_nc_worker RIP: 0010:subflow_data_ready+0x39f/0x690 net/mptcp/subflow.c:1405 Code: 18 89 ee e8 e3 d2 21 f7 40 84 ed 75 1f e8 a9 d7 21 f7 44 89 fe bf 07 00 00 00 e8 0c d3 21 f7 41 83 ff 07 74 07 e8 91 d7 21 f7 <0f> 0b e8 8a d7 21 f7 48 89 df e8 d2 b2 ff ff 31 ff 89 c5 89 c6 e8 RSP: 0018:ffffc90000007448 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff888031efc700 RCX: ffffffff8a65baf4 RDX: ffff888043222140 RSI: ffffffff8a65baff RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000007 R10: 000000000000000b R11: 0000000000000000 R12: 1ffff92000000e89 R13: ffff88807a534d80 R14: ffff888021c11a00 R15: 000000000000000b FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fa19a0ffc81 CR3: 000000007a2db000 CR4: 00000000003506f0 DR0: 000000000000d8dd DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Call Trace: tcp_data_ready+0x14c/0x5b0 net/ipv4/tcp_input.c:5128 tcp_data_queue+0x19c3/0x5190 net/ipv4/tcp_input.c:5208 tcp_rcv_state_process+0x11ef/0x4e10 net/ipv4/tcp_input.c:6844 tcp_v4_do_rcv+0x369/0xa10 net/ipv4/tcp_ipv4.c:1929 tcp_v4_rcv+0x3888/0x3b30 net/ipv4/tcp_ipv4.c:2329 ip_protocol_deliver_rcu+0x9f/0x480 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2e4/0x510 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_local_deliver+0x1b6/0x550 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:461 [inline] ip_rcv_finish+0x1c4/0x2e0 net/ipv4/ip_input.c:449 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_rcv+0xce/0x440 net/ipv4/ip_input.c:569 __netif_receive_skb_one_core+0x115/0x180 net/core/dev.c:5527 __netif_receive_skb+0x1f/0x1b0 net/core/dev.c:5641 process_backlog+0x101/0x6b0 net/core/dev.c:5969 __napi_poll.constprop.0+0xb4/0x540 net/core/dev.c:6531 napi_poll net/core/dev.c:6600 [inline] net_rx_action+0x956/0xe90 net/core/dev.c:6733 __do_softirq+0x21a/0x968 kernel/softirq.c:553 do_softirq kernel/softirq.c:454 [inline] do_softirq+0xaa/0xe0 kernel/softirq.c:441 __local_bh_enable_ip+0xf8/0x120 kernel/softirq.c:381 spin_unlock_bh include/linux/spinlock.h:396 [inline] batadv_nc_purge_paths+0x1ce/0x3c0 net/batman-adv/network-coding.c:471 batadv_nc_worker+0x9b1/0x10e0 net/batman-adv/network-coding.c:722 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 To address the issue, catch the racing subflow state change and use it to cause the MPTCP fallback. Such fallback is also used to cause the first subflow state propagation to the msk socket via mptcp_set_connected(). After this change, the first subflow can additionally propagate the TCP_FIN_WAIT1 state, so rename the helper accordingly. Finally, if the state propagation is delayed to the msk release callback, the first subflow can change to a different state in between. Cache the relevant target state in a new msk-level field and use such value to update the msk state at release time. Fixes: 1e777f39b4d7 ("mptcp: add MSG_FASTOPEN sendmsg flag support") Cc: stable@vger.kernel.org Reported-by: Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/458 Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- net/mptcp/protocol.c | 6 +++--- net/mptcp/protocol.h | 9 ++++++--- net/mptcp/subflow.c | 28 +++++++++++++++++----------- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index bc81ea53a049..5cd5c3f535a8 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3402,12 +3402,12 @@ static void mptcp_release_cb(struct sock *sk) if (__test_and_clear_bit(MPTCP_CLEAN_UNA, &msk->cb_flags)) __mptcp_clean_una_wakeup(sk); if (unlikely(msk->cb_flags)) { - /* be sure to set the current sk state before taking actions + /* be sure to sync the msk state before taking actions * depending on sk_state (MPTCP_ERROR_REPORT) * On sk release avoid actions depending on the first subflow */ - if (__test_and_clear_bit(MPTCP_CONNECTED, &msk->cb_flags) && msk->first) - __mptcp_set_connected(sk); + if (__test_and_clear_bit(MPTCP_SYNC_STATE, &msk->cb_flags) && msk->first) + __mptcp_sync_state(sk, msk->pending_state); if (__test_and_clear_bit(MPTCP_ERROR_REPORT, &msk->cb_flags)) __mptcp_error_report(sk); if (__test_and_clear_bit(MPTCP_SYNC_SNDBUF, &msk->cb_flags)) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index fe6f2d399ee8..aa1a93fe40ff 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -124,7 +124,7 @@ #define MPTCP_ERROR_REPORT 3 #define MPTCP_RETRANSMIT 4 #define MPTCP_FLUSH_JOIN_LIST 5 -#define MPTCP_CONNECTED 6 +#define MPTCP_SYNC_STATE 6 #define MPTCP_SYNC_SNDBUF 7 struct mptcp_skb_cb { @@ -296,6 +296,9 @@ struct mptcp_sock { bool use_64bit_ack; /* Set when we received a 64-bit DSN */ bool csum_enabled; bool allow_infinite_fallback; + u8 pending_state; /* A subflow asked to set this sk_state, + * protected by the msk data lock + */ u8 mpc_endpoint_id; u8 recvmsg_inq:1, cork:1, @@ -728,7 +731,7 @@ void mptcp_get_options(const struct sk_buff *skb, struct mptcp_options_received *mp_opt); void mptcp_finish_connect(struct sock *sk); -void __mptcp_set_connected(struct sock *sk); +void __mptcp_sync_state(struct sock *sk, int state); void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tout); static inline void mptcp_stop_tout_timer(struct sock *sk) @@ -1115,7 +1118,7 @@ static inline bool subflow_simultaneous_connect(struct sock *sk) { struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); - return sk->sk_state == TCP_ESTABLISHED && + return (1 << sk->sk_state) & (TCPF_ESTABLISHED | TCPF_FIN_WAIT1) && is_active_ssk(subflow) && !subflow->conn_finished; } diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a4f3c27f0309..6d7684c35e93 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -419,22 +419,28 @@ static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct soc return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport; } -void __mptcp_set_connected(struct sock *sk) +void __mptcp_sync_state(struct sock *sk, int state) { - __mptcp_propagate_sndbuf(sk, mptcp_sk(sk)->first); + struct mptcp_sock *msk = mptcp_sk(sk); + + __mptcp_propagate_sndbuf(sk, msk->first); if (sk->sk_state == TCP_SYN_SENT) { - inet_sk_state_store(sk, TCP_ESTABLISHED); + inet_sk_state_store(sk, state); sk->sk_state_change(sk); } } -static void mptcp_set_connected(struct sock *sk) +static void mptcp_propagate_state(struct sock *sk, struct sock *ssk) { + struct mptcp_sock *msk = mptcp_sk(sk); + mptcp_data_lock(sk); - if (!sock_owned_by_user(sk)) - __mptcp_set_connected(sk); - else - __set_bit(MPTCP_CONNECTED, &mptcp_sk(sk)->cb_flags); + if (!sock_owned_by_user(sk)) { + __mptcp_sync_state(sk, ssk->sk_state); + } else { + msk->pending_state = ssk->sk_state; + __set_bit(MPTCP_SYNC_STATE, &msk->cb_flags); + } mptcp_data_unlock(sk); } @@ -496,7 +502,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) subflow_set_remote_key(msk, subflow, &mp_opt); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPCAPABLEACTIVEACK); mptcp_finish_connect(sk); - mptcp_set_connected(parent); + mptcp_propagate_state(parent, sk); } else if (subflow->request_join) { u8 hmac[SHA256_DIGEST_SIZE]; @@ -540,7 +546,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) } else if (mptcp_check_fallback(sk)) { fallback: mptcp_rcv_space_init(msk, sk); - mptcp_set_connected(parent); + mptcp_propagate_state(parent, sk); } return; @@ -1740,7 +1746,7 @@ static void subflow_state_change(struct sock *sk) mptcp_rcv_space_init(msk, sk); pr_fallback(msk); subflow->conn_finished = 1; - mptcp_set_connected(parent); + mptcp_propagate_state(parent, sk); } /* as recvmsg() does not acquire the subflow socket for ssk selection From patchwork Fri Dec 15 16:04:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 755020 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 EBC343FB0A; Fri, 15 Dec 2023 16:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Pf6Oc8SN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6836C433C7; Fri, 15 Dec 2023 16:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702656296; bh=wv16uUjSEMOy9J01JHL3XI8cunmlAlYDGAk/FjvlM4c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Pf6Oc8SN2HjIoPseWNAwLV1clz8tPavf5dvZwaa7jqMyb4F8lylFQL0tkecv54AqD 78qwXtAFg1sNQv05g0igd+OrYjvE+7Qrkg6WhoKVpivnl05Z8SElRb3/4Y9dHKhOCi e5TkipUqUIGx8gBnmkX8XzibHsks908L44I9Wb8YgPaWtBIPv9CuuuqoblDu3RAbfJ w3SvfqHfjgtRv2sq2TFvzXhw5qDf4dwqduxy6C6B8oQHNS2t9Yl/FzZRwyStU41Uu4 We9H1ycNjvEN1baWHEOzATXzUn5DHlQ1EQZv5H2zsmK4OtFXpZpgOsvPvipo+UN/Lb Vtcwn8noiqlgQ== From: Matthieu Baerts Date: Fri, 15 Dec 2023 17:04:26 +0100 Subject: [PATCH net 3/4] mptcp: fill in missing MODULE_DESCRIPTION() Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-3-91d20266d525@kernel.org> References: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> In-Reply-To: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Benjamin Hesmans , Dmytro Shytyi Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Matthieu Baerts X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1084; i=matttbe@kernel.org; h=from:subject:message-id; bh=wv16uUjSEMOy9J01JHL3XI8cunmlAlYDGAk/FjvlM4c=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlfHkbJEIM8HM3FBpDE/k2Yrbs2Tu9fv3aUuXcU xIXAioazrKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZXx5GwAKCRD2t4JPQmmg cwIXEADvVx+1Gy4VOUmvA8g9dXGjSNGzR1izb7UbNpU0CoxKb6DtzPlCKMg/2+bqLgEKQ1a8dKX AJGiCc1Z8aWNraN9kjq3rBLssJ7XNF+eTmpHygj4syDVXaNxaM78btPqP8t2+Hd7NFn7q1SSqGB mE+pfUtdd3IWFKekpSmX0iCe0clSEKmAZFDCTOadSXdLL+YEnWWD3ekYmJStOne1h9RQAqotblo U5dgR2ftDckkDxRb5Mmi839gpO0rCPB41erRvhLArrXpTvaXdcOqdUYua4iNG6HKy2jjzKnW9fq mYG5kUeSoyGCHmkF4F+Ss7AAg4/R/xr/X442rdjXdb1MMSDMuIkj26PVTlYLdAjxjTm/tCOQfN0 0LG3TlhfUixBQcOiYenGaib06SDemqMZJu6MmoTy7ByPGinZ0CUFMuvsSB1N9KKQ5k7Xm6pM6u8 Kcx0M4zYkhar+XXXRRDMmv2s90tmfLeHFwEjNakfgJrctj1F9C2DqtBk93Yof2U4uYV5/CbHaL4 crHXzbIL1aIY2hYsWKLtJoRbqJgCEJmOXUc66quFy6I/1AkSeXYMleYGX/F7cTl5xt58DxQbwpk kjVVhIoTRdNAvdPx6LLDmf6lnOYpZFGA/ZxpB3A9UpYP3XutdIHoHclbikfcPAcd3Lsmbbrow2I QkAKnKp0J8bBArg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 W=1 builds warn on missing MODULE_DESCRIPTION, add them here in MPTCP. Only two were missing: two modules with different KUnit tests for MPTCP. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- net/mptcp/crypto_test.c | 1 + net/mptcp/token_test.c | 1 + 2 files changed, 2 insertions(+) diff --git a/net/mptcp/crypto_test.c b/net/mptcp/crypto_test.c index 017248dea038..220414e5c850 100644 --- a/net/mptcp/crypto_test.c +++ b/net/mptcp/crypto_test.c @@ -70,3 +70,4 @@ static struct kunit_suite mptcp_crypto_suite = { kunit_test_suite(mptcp_crypto_suite); MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("KUnit tests for MPTCP Crypto"); diff --git a/net/mptcp/token_test.c b/net/mptcp/token_test.c index 0758865ab658..bfff53e668da 100644 --- a/net/mptcp/token_test.c +++ b/net/mptcp/token_test.c @@ -143,3 +143,4 @@ static struct kunit_suite mptcp_token_suite = { kunit_test_suite(mptcp_token_suite); MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("KUnit tests for MPTCP Token"); From patchwork Fri Dec 15 16:04:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 754707 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 D5A7C3FE40; Fri, 15 Dec 2023 16:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DQaX8NIH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBB61C433C9; Fri, 15 Dec 2023 16:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702656299; bh=mEEyQsmCIMqT+EIvuVvdc3euGh/zmow8EeCo+TKdPoI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DQaX8NIHovESKeQHduownHwMEP6hKSiwqfTNrSbRob8tHe0iy5+a0MbS3K36UW0LB Bx+EKlsXdWwe1njy+BjfIkn465pMaqn5fF30hAaOVJuzv1pK0x+xI/Nu4gexzQBnH6 g+uCLgTs1YUz0cKDLcCrNlgmz9+7QBpGDoHbp6FJDEuLzUWT++XzSNeNwUG6tynLua WKiaZUDrnndRuFowgNUA+caZbJIfg4ncGKSShMfiU8PwE6EPalE1XLMhVXFWkNvXN9 4wc6GUHWCW0Rr9WpwcTnjJKbPCjED5waZBJz+5OarHKz5RqHGuY6JKnJERYw0g2Owg MY4lXLluw0BRg== From: Matthieu Baerts Date: Fri, 15 Dec 2023 17:04:27 +0100 Subject: [PATCH net 4/4] mailmap: add entries for Geliang Tang Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-4-91d20266d525@kernel.org> References: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> In-Reply-To: <20231215-upstream-net-20231215-mptcp-misc-fixes-v1-0-91d20266d525@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Benjamin Hesmans , Dmytro Shytyi Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Matthieu Baerts , Geliang Tang X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1162; i=matttbe@kernel.org; h=from:subject:message-id; bh=F+SFbQ1h53EM63JkYmEA4FqecIVJLbDI7sWcAXIJA8A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBlfHkbBU0vL8oo3TD8O7+05tLkIK3rTr1TIpgbC XH5/mXP5q2JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZXx5GwAKCRD2t4JPQmmg c1bdD/9Df8lKXoEqQTB1znSsnUo6yQt/h0EVbLpP4kcIVAtsQWlJeJ6bXZEyP5u1ONR6N+b95oK NOccqbP9Nkl/60ZWH5XdRKEpM9NMDSNwukvKZwDMEkm9pA8Hn5Fs5wqs3TH5wYNNJKUFMcNv91E uVzCLPzLGgUAbKSe5zNAimEci0SIQEX8H4Hc87rY89TwDbWimwHNyPwvCqHrSCe8MRRG+mlXbrG N3Inf3AtVwF8AAjwisUTVOSJKkD1hAx+SKZQne973WYOAUXuVytOjZnoEXXL4phVrtFVJQu6wRc 3ydVuWfPf2dVw583zyH8E6ku0HqQeCVwPJOICdfK+GzIiJhxBh6f7UZpL5a1or39U/poT83BOiQ yr35vOCGqC2+zjbkRGv6VLkLoopQi4slPXiD+JEYY/wSgpQO+SyNDwyKLNiSR3h7YAMgTqmERkp aSaP3lL5vnLaUvUxscO5rayZ/nA7rw3YXvgaFkl5drMDzzByqjjiw/rI078MWqpVAuMCZMNnLhD /VsJfbEacNnLU4cRObB5n3xS6vtH6Q66ge4NqMkyFKJ8A69z1lbxB5cZGnVdy9Fcd6a9v8SkgTD AjsgHx8g3l+f/JBO1KMd80xk+PAJpY3yvYt5ShHTMmt5vsFTXq8+BVPjhHJ3iFyXCRopBSDOC4S km518yJZ7BevPXg== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang Map Geliang's old mail addresses to his @linux.dev one. Suggested-by: Mat Martineau Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts --- .mailmap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.mailmap b/.mailmap index 3ac1c12545f2..68e72a6017a0 100644 --- a/.mailmap +++ b/.mailmap @@ -191,6 +191,10 @@ Gao Xiang Gao Xiang Gao Xiang Gao Xiang +Geliang Tang +Geliang Tang +Geliang Tang +Geliang Tang Georgi Djakov Gerald Schaefer Gerald Schaefer