From: Greg Kroah-Hartman Date: Wed, 25 May 2022 07:52:03 +0000 (+0200) Subject: drop some mptcp patches from 5.15 and 5.17 X-Git-Tag: v5.15.42~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d83cedca38cdc97a41e67e15a280b0f6c0c46257;p=thirdparty%2Fkernel%2Fstable-queue.git drop some mptcp patches from 5.15 and 5.17 --- diff --git a/queue-5.15/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch b/queue-5.15/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch deleted file mode 100644 index 1ee4c2eb2e0..00000000000 --- a/queue-5.15/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 4f06dacef3a5b9868dce9d9cecb2fcd7bae9833e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 17 May 2022 11:02:12 -0700 -Subject: mptcp: Do TCP fallback on early DSS checksum failure - -From: Mat Martineau - -[ Upstream commit ae66fb2ba6c3dcaf8b9612b65aa949a1a4bed150 ] - -RFC 8684 section 3.7 describes several opportunities for a MPTCP -connection to "fall back" to regular TCP early in the connection -process, before it has been confirmed that MPTCP options can be -successfully propagated on all SYN, SYN/ACK, and data packets. If a peer -acknowledges the first received data packet with a regular TCP header -(no MPTCP options), fallback is allowed. - -If the recipient of that first data packet finds a MPTCP DSS checksum -error, this provides an opportunity to fail gracefully with a TCP -fallback rather than resetting the connection (as might happen if a -checksum failure were detected later). - -This commit modifies the checksum failure code to attempt fallback on -the initial subflow of a MPTCP connection, only if it's a failure in the -first data mapping. In cases where the peer initiates the connection, -requests checksums, is the first to send data, and the peer is sending -incorrect checksums (see -https://github.com/multipath-tcp/mptcp_net-next/issues/275), this allows -the connection to proceed as TCP rather than reset. - -Fixes: dd8bcd1768ff ("mptcp: validate the data checksum") -Acked-by: Paolo Abeni -Signed-off-by: Mat Martineau -Signed-off-by: David S. Miller -Signed-off-by: Sasha Levin ---- - net/mptcp/protocol.h | 3 ++- - net/mptcp/subflow.c | 21 ++++++++++++++++++--- - 2 files changed, 20 insertions(+), 4 deletions(-) - -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index 8d70e491139a..62ad31482644 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -437,7 +437,8 @@ struct mptcp_subflow_context { - can_ack : 1, /* only after processing the remote a key */ - disposable : 1, /* ctx can be free at ulp release time */ - stale : 1, /* unable to snd/rcv data, do not use for xmit */ -- local_id_valid : 1; /* local_id is correctly initialized */ -+ local_id_valid : 1, /* local_id is correctly initialized */ -+ valid_csum_seen : 1; /* at least one csum validated */ - enum mptcp_data_avail data_avail; - u32 remote_nonce; - u64 thmac; -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index 204dfb82f697..c52a824c0669 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -958,11 +958,14 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * - subflow->map_data_csum); - if (unlikely(csum)) { - MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); -- subflow->send_mp_fail = 1; -- MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); -+ if (subflow->mp_join || subflow->valid_csum_seen) { -+ subflow->send_mp_fail = 1; -+ MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); -+ } - return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY; - } - -+ subflow->valid_csum_seen = 1; - return MAPPING_OK; - } - -@@ -1144,6 +1147,18 @@ static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ss - } - } - -+static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) -+{ -+ struct mptcp_sock *msk = mptcp_sk(subflow->conn); -+ -+ if (subflow->mp_join) -+ return false; -+ else if (READ_ONCE(msk->csum_enabled)) -+ return !subflow->valid_csum_seen; -+ else -+ return !subflow->fully_established; -+} -+ - static bool subflow_check_data_avail(struct sock *ssk) - { - struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); -@@ -1221,7 +1236,7 @@ static bool subflow_check_data_avail(struct sock *ssk) - return true; - } - -- if (subflow->mp_join || subflow->fully_established) { -+ if (!subflow_can_fallback(subflow)) { - /* fatal protocol error, close the socket. - * subflow_error_report() will introduce the appropriate barriers - */ --- -2.35.1 - diff --git a/queue-5.15/mptcp-strict-local-address-id-selection.patch b/queue-5.15/mptcp-strict-local-address-id-selection.patch deleted file mode 100644 index 1169286aa73..00000000000 --- a/queue-5.15/mptcp-strict-local-address-id-selection.patch +++ /dev/null @@ -1,224 +0,0 @@ -From a8838be5ddf0965ef545407208757c69cc57edad Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 7 Mar 2022 12:44:37 -0800 -Subject: mptcp: strict local address ID selection - -From: Paolo Abeni - -[ Upstream commit 4cf86ae84c718333928fd2d43168a1e359a28329 ] - -The address ID selection for MPJ subflows created in response -to incoming ADD_ADDR option is currently unreliable: it happens -at MPJ socket creation time, when the local address could be -unknown. - -Additionally, if the no local endpoint is available for the local -address, a new dummy endpoint is created, confusing the user-land. - -This change refactor the code to move the address ID selection inside -the rebuild_header() helper, when the local address eventually -selected by the route lookup is finally known. If the address used -is not mapped by any endpoint - and thus can't be advertised/removed -pick the id 0 instead of allocate a new endpoint. - -Signed-off-by: Paolo Abeni -Signed-off-by: Mat Martineau -Signed-off-by: Jakub Kicinski -Signed-off-by: Sasha Levin ---- - net/mptcp/pm_netlink.c | 13 -------- - net/mptcp/protocol.c | 3 ++ - net/mptcp/protocol.h | 3 +- - net/mptcp/subflow.c | 67 ++++++++++++++++++++++++++++++++++++------ - 4 files changed, 63 insertions(+), 23 deletions(-) - -diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c -index cf0f700f46dd..e6b95d1cba70 100644 ---- a/net/mptcp/pm_netlink.c -+++ b/net/mptcp/pm_netlink.c -@@ -86,16 +86,6 @@ static bool addresses_equal(const struct mptcp_addr_info *a, - return a->port == b->port; - } - --static bool address_zero(const struct mptcp_addr_info *addr) --{ -- struct mptcp_addr_info zero; -- -- memset(&zero, 0, sizeof(zero)); -- zero.family = addr->family; -- -- return addresses_equal(addr, &zero, true); --} -- - static void local_address(const struct sock_common *skc, - struct mptcp_addr_info *addr) - { -@@ -954,9 +944,6 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) - if (addresses_equal(&msk_local, &skc_local, false)) - return 0; - -- if (address_zero(&skc_local)) -- return 0; -- - pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); - - rcu_read_lock(); -diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c -index d6def23b8cba..c293742fc461 100644 ---- a/net/mptcp/protocol.c -+++ b/net/mptcp/protocol.c -@@ -115,6 +115,9 @@ static int __mptcp_socket_create(struct mptcp_sock *msk) - list_add(&subflow->node, &msk->conn_list); - sock_hold(ssock->sk); - subflow->request_mptcp = 1; -+ -+ /* This is the first subflow, always with id 0 */ -+ subflow->local_id_valid = 1; - mptcp_sock_graft(msk->first, sk->sk_socket); - - return 0; -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index 72a259a74b57..8d70e491139a 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -436,7 +436,8 @@ struct mptcp_subflow_context { - rx_eof : 1, - can_ack : 1, /* only after processing the remote a key */ - disposable : 1, /* ctx can be free at ulp release time */ -- stale : 1; /* unable to snd/rcv data, do not use for xmit */ -+ stale : 1, /* unable to snd/rcv data, do not use for xmit */ -+ local_id_valid : 1; /* local_id is correctly initialized */ - enum mptcp_data_avail data_avail; - u32 remote_nonce; - u64 thmac; -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index 9c7deffe7cb6..204dfb82f697 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -483,6 +483,51 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) - mptcp_subflow_reset(sk); - } - -+static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) -+{ -+ subflow->local_id = local_id; -+ subflow->local_id_valid = 1; -+} -+ -+static int subflow_chk_local_id(struct sock *sk) -+{ -+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); -+ struct mptcp_sock *msk = mptcp_sk(subflow->conn); -+ int err; -+ -+ if (likely(subflow->local_id_valid)) -+ return 0; -+ -+ err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); -+ if (err < 0) -+ return err; -+ -+ subflow_set_local_id(subflow, err); -+ return 0; -+} -+ -+static int subflow_rebuild_header(struct sock *sk) -+{ -+ int err = subflow_chk_local_id(sk); -+ -+ if (unlikely(err < 0)) -+ return err; -+ -+ return inet_sk_rebuild_header(sk); -+} -+ -+#if IS_ENABLED(CONFIG_MPTCP_IPV6) -+static int subflow_v6_rebuild_header(struct sock *sk) -+{ -+ int err = subflow_chk_local_id(sk); -+ -+ if (unlikely(err < 0)) -+ return err; -+ -+ return inet6_sk_rebuild_header(sk); -+} -+#endif -+ - struct request_sock_ops mptcp_subflow_request_sock_ops; - EXPORT_SYMBOL_GPL(mptcp_subflow_request_sock_ops); - static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops; -@@ -1402,13 +1447,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - get_random_bytes(&subflow->local_nonce, sizeof(u32)); - } while (!subflow->local_nonce); - -- if (!local_id) { -- err = mptcp_pm_get_local_id(msk, (struct sock_common *)ssk); -- if (err < 0) -- goto failed; -- -- local_id = err; -- } -+ if (local_id) -+ subflow_set_local_id(subflow, local_id); - - mptcp_pm_get_flags_and_ifindex_by_id(sock_net(sk), local_id, - &flags, &ifindex); -@@ -1431,7 +1471,6 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk, - remote_token, local_id, remote_id); - subflow->remote_token = remote_token; -- subflow->local_id = local_id; - subflow->remote_id = remote_id; - subflow->request_join = 1; - subflow->request_bkup = !!(flags & MPTCP_PM_ADDR_FLAG_BACKUP); -@@ -1734,15 +1773,22 @@ static void subflow_ulp_clone(const struct request_sock *req, - new_ctx->token = subflow_req->token; - new_ctx->ssn_offset = subflow_req->ssn_offset; - new_ctx->idsn = subflow_req->idsn; -+ -+ /* this is the first subflow, id is always 0 */ -+ new_ctx->local_id_valid = 1; - } else if (subflow_req->mp_join) { - new_ctx->ssn_offset = subflow_req->ssn_offset; - new_ctx->mp_join = 1; - new_ctx->fully_established = 1; - new_ctx->backup = subflow_req->backup; -- new_ctx->local_id = subflow_req->local_id; - new_ctx->remote_id = subflow_req->remote_id; - new_ctx->token = subflow_req->token; - new_ctx->thmac = subflow_req->thmac; -+ -+ /* the subflow req id is valid, fetched via subflow_check_req() -+ * and subflow_token_join_request() -+ */ -+ subflow_set_local_id(new_ctx, subflow_req->local_id); - } - } - -@@ -1795,6 +1841,7 @@ void __init mptcp_subflow_init(void) - subflow_specific.conn_request = subflow_v4_conn_request; - subflow_specific.syn_recv_sock = subflow_syn_recv_sock; - subflow_specific.sk_rx_dst_set = subflow_finish_connect; -+ subflow_specific.rebuild_header = subflow_rebuild_header; - - tcp_prot_override = tcp_prot; - tcp_prot_override.release_cb = tcp_release_cb_override; -@@ -1807,6 +1854,7 @@ void __init mptcp_subflow_init(void) - subflow_v6_specific.conn_request = subflow_v6_conn_request; - subflow_v6_specific.syn_recv_sock = subflow_syn_recv_sock; - subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; -+ subflow_v6_specific.rebuild_header = subflow_v6_rebuild_header; - - subflow_v6m_specific = subflow_v6_specific; - subflow_v6m_specific.queue_xmit = ipv4_specific.queue_xmit; -@@ -1814,6 +1862,7 @@ void __init mptcp_subflow_init(void) - subflow_v6m_specific.net_header_len = ipv4_specific.net_header_len; - subflow_v6m_specific.mtu_reduced = ipv4_specific.mtu_reduced; - subflow_v6m_specific.net_frag_header_len = 0; -+ subflow_v6m_specific.rebuild_header = subflow_rebuild_header; - - tcpv6_prot_override = tcpv6_prot; - tcpv6_prot_override.release_cb = tcp_release_cb_override; --- -2.35.1 - diff --git a/queue-5.15/series b/queue-5.15/series index 837f482f6a8..ea61cd895a3 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -95,8 +95,6 @@ arm-9197-1-spectre-bhb-fix-loop8-sequence-for-thumb2.patch mptcp-change-the-parameter-of-__mptcp_make_csum.patch mptcp-reuse-__mptcp_make_csum-in-validate_data_csum.patch mptcp-fix-checksum-byte-order.patch -mptcp-strict-local-address-id-selection.patch -mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch igb-skip-phy-status-check-where-unavailable.patch netfilter-flowtable-fix-tcp-flow-teardown.patch netfilter-flowtable-pass-flowtable-to-nf_flow_table_.patch diff --git a/queue-5.17/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch b/queue-5.17/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch deleted file mode 100644 index ed2e7a2d024..00000000000 --- a/queue-5.17/mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch +++ /dev/null @@ -1,105 +0,0 @@ -From eefba3dc384cddc4489efcd6b32d9e05f38d00d4 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 17 May 2022 11:02:12 -0700 -Subject: mptcp: Do TCP fallback on early DSS checksum failure - -From: Mat Martineau - -[ Upstream commit ae66fb2ba6c3dcaf8b9612b65aa949a1a4bed150 ] - -RFC 8684 section 3.7 describes several opportunities for a MPTCP -connection to "fall back" to regular TCP early in the connection -process, before it has been confirmed that MPTCP options can be -successfully propagated on all SYN, SYN/ACK, and data packets. If a peer -acknowledges the first received data packet with a regular TCP header -(no MPTCP options), fallback is allowed. - -If the recipient of that first data packet finds a MPTCP DSS checksum -error, this provides an opportunity to fail gracefully with a TCP -fallback rather than resetting the connection (as might happen if a -checksum failure were detected later). - -This commit modifies the checksum failure code to attempt fallback on -the initial subflow of a MPTCP connection, only if it's a failure in the -first data mapping. In cases where the peer initiates the connection, -requests checksums, is the first to send data, and the peer is sending -incorrect checksums (see -https://github.com/multipath-tcp/mptcp_net-next/issues/275), this allows -the connection to proceed as TCP rather than reset. - -Fixes: dd8bcd1768ff ("mptcp: validate the data checksum") -Acked-by: Paolo Abeni -Signed-off-by: Mat Martineau -Signed-off-by: David S. Miller -Signed-off-by: Sasha Levin ---- - net/mptcp/protocol.h | 3 ++- - net/mptcp/subflow.c | 21 ++++++++++++++++++--- - 2 files changed, 20 insertions(+), 4 deletions(-) - -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index e4413b3e50c2..8015389859d9 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -443,7 +443,8 @@ struct mptcp_subflow_context { - can_ack : 1, /* only after processing the remote a key */ - disposable : 1, /* ctx can be free at ulp release time */ - stale : 1, /* unable to snd/rcv data, do not use for xmit */ -- local_id_valid : 1; /* local_id is correctly initialized */ -+ local_id_valid : 1, /* local_id is correctly initialized */ -+ valid_csum_seen : 1; /* at least one csum validated */ - enum mptcp_data_avail data_avail; - u32 remote_nonce; - u64 thmac; -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index e27574e9f969..7a3a70067c80 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -958,11 +958,14 @@ static enum mapping_status validate_data_csum(struct sock *ssk, struct sk_buff * - subflow->map_data_csum); - if (unlikely(csum)) { - MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DATACSUMERR); -- subflow->send_mp_fail = 1; -- MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); -+ if (subflow->mp_join || subflow->valid_csum_seen) { -+ subflow->send_mp_fail = 1; -+ MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_MPFAILTX); -+ } - return subflow->mp_join ? MAPPING_INVALID : MAPPING_DUMMY; - } - -+ subflow->valid_csum_seen = 1; - return MAPPING_OK; - } - -@@ -1144,6 +1147,18 @@ static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ss - } - } - -+static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) -+{ -+ struct mptcp_sock *msk = mptcp_sk(subflow->conn); -+ -+ if (subflow->mp_join) -+ return false; -+ else if (READ_ONCE(msk->csum_enabled)) -+ return !subflow->valid_csum_seen; -+ else -+ return !subflow->fully_established; -+} -+ - static bool subflow_check_data_avail(struct sock *ssk) - { - struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk); -@@ -1221,7 +1236,7 @@ static bool subflow_check_data_avail(struct sock *ssk) - return true; - } - -- if (subflow->mp_join || subflow->fully_established) { -+ if (!subflow_can_fallback(subflow)) { - /* fatal protocol error, close the socket. - * subflow_error_report() will introduce the appropriate barriers - */ --- -2.35.1 - diff --git a/queue-5.17/mptcp-strict-local-address-id-selection.patch b/queue-5.17/mptcp-strict-local-address-id-selection.patch deleted file mode 100644 index 12d3ada4de5..00000000000 --- a/queue-5.17/mptcp-strict-local-address-id-selection.patch +++ /dev/null @@ -1,224 +0,0 @@ -From dd874ab95a2df6fce00831bf16a06ed827639f6c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 7 Mar 2022 12:44:37 -0800 -Subject: mptcp: strict local address ID selection - -From: Paolo Abeni - -[ Upstream commit 4cf86ae84c718333928fd2d43168a1e359a28329 ] - -The address ID selection for MPJ subflows created in response -to incoming ADD_ADDR option is currently unreliable: it happens -at MPJ socket creation time, when the local address could be -unknown. - -Additionally, if the no local endpoint is available for the local -address, a new dummy endpoint is created, confusing the user-land. - -This change refactor the code to move the address ID selection inside -the rebuild_header() helper, when the local address eventually -selected by the route lookup is finally known. If the address used -is not mapped by any endpoint - and thus can't be advertised/removed -pick the id 0 instead of allocate a new endpoint. - -Signed-off-by: Paolo Abeni -Signed-off-by: Mat Martineau -Signed-off-by: Jakub Kicinski -Signed-off-by: Sasha Levin ---- - net/mptcp/pm_netlink.c | 13 -------- - net/mptcp/protocol.c | 3 ++ - net/mptcp/protocol.h | 3 +- - net/mptcp/subflow.c | 67 ++++++++++++++++++++++++++++++++++++------ - 4 files changed, 63 insertions(+), 23 deletions(-) - -diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c -index 4b5d795383cd..ec73bd4be0a8 100644 ---- a/net/mptcp/pm_netlink.c -+++ b/net/mptcp/pm_netlink.c -@@ -83,16 +83,6 @@ static bool addresses_equal(const struct mptcp_addr_info *a, - return a->port == b->port; - } - --static bool address_zero(const struct mptcp_addr_info *addr) --{ -- struct mptcp_addr_info zero; -- -- memset(&zero, 0, sizeof(zero)); -- zero.family = addr->family; -- -- return addresses_equal(addr, &zero, true); --} -- - static void local_address(const struct sock_common *skc, - struct mptcp_addr_info *addr) - { -@@ -1011,9 +1001,6 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc) - if (addresses_equal(&msk_local, &skc_local, false)) - return 0; - -- if (address_zero(&skc_local)) -- return 0; -- - pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id); - - rcu_read_lock(); -diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c -index 014c9d88f947..cb90941840b1 100644 ---- a/net/mptcp/protocol.c -+++ b/net/mptcp/protocol.c -@@ -117,6 +117,9 @@ static int __mptcp_socket_create(struct mptcp_sock *msk) - list_add(&subflow->node, &msk->conn_list); - sock_hold(ssock->sk); - subflow->request_mptcp = 1; -+ -+ /* This is the first subflow, always with id 0 */ -+ subflow->local_id_valid = 1; - mptcp_sock_graft(msk->first, sk->sk_socket); - - return 0; -diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h -index aec767ee047a..e4413b3e50c2 100644 ---- a/net/mptcp/protocol.h -+++ b/net/mptcp/protocol.h -@@ -442,7 +442,8 @@ struct mptcp_subflow_context { - rx_eof : 1, - can_ack : 1, /* only after processing the remote a key */ - disposable : 1, /* ctx can be free at ulp release time */ -- stale : 1; /* unable to snd/rcv data, do not use for xmit */ -+ stale : 1, /* unable to snd/rcv data, do not use for xmit */ -+ local_id_valid : 1; /* local_id is correctly initialized */ - enum mptcp_data_avail data_avail; - u32 remote_nonce; - u64 thmac; -diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c -index 651f01d13191..e27574e9f969 100644 ---- a/net/mptcp/subflow.c -+++ b/net/mptcp/subflow.c -@@ -483,6 +483,51 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) - mptcp_subflow_reset(sk); - } - -+static void subflow_set_local_id(struct mptcp_subflow_context *subflow, int local_id) -+{ -+ subflow->local_id = local_id; -+ subflow->local_id_valid = 1; -+} -+ -+static int subflow_chk_local_id(struct sock *sk) -+{ -+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); -+ struct mptcp_sock *msk = mptcp_sk(subflow->conn); -+ int err; -+ -+ if (likely(subflow->local_id_valid)) -+ return 0; -+ -+ err = mptcp_pm_get_local_id(msk, (struct sock_common *)sk); -+ if (err < 0) -+ return err; -+ -+ subflow_set_local_id(subflow, err); -+ return 0; -+} -+ -+static int subflow_rebuild_header(struct sock *sk) -+{ -+ int err = subflow_chk_local_id(sk); -+ -+ if (unlikely(err < 0)) -+ return err; -+ -+ return inet_sk_rebuild_header(sk); -+} -+ -+#if IS_ENABLED(CONFIG_MPTCP_IPV6) -+static int subflow_v6_rebuild_header(struct sock *sk) -+{ -+ int err = subflow_chk_local_id(sk); -+ -+ if (unlikely(err < 0)) -+ return err; -+ -+ return inet6_sk_rebuild_header(sk); -+} -+#endif -+ - struct request_sock_ops mptcp_subflow_request_sock_ops; - EXPORT_SYMBOL_GPL(mptcp_subflow_request_sock_ops); - static struct tcp_request_sock_ops subflow_request_sock_ipv4_ops; -@@ -1401,13 +1446,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - get_random_bytes(&subflow->local_nonce, sizeof(u32)); - } while (!subflow->local_nonce); - -- if (!local_id) { -- err = mptcp_pm_get_local_id(msk, (struct sock_common *)ssk); -- if (err < 0) -- goto failed; -- -- local_id = err; -- } -+ if (local_id) -+ subflow_set_local_id(subflow, local_id); - - mptcp_pm_get_flags_and_ifindex_by_id(sock_net(sk), local_id, - &flags, &ifindex); -@@ -1432,7 +1472,6 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk, - remote_token, local_id, remote_id); - subflow->remote_token = remote_token; -- subflow->local_id = local_id; - subflow->remote_id = remote_id; - subflow->request_join = 1; - subflow->request_bkup = !!(flags & MPTCP_PM_ADDR_FLAG_BACKUP); -@@ -1737,15 +1776,22 @@ static void subflow_ulp_clone(const struct request_sock *req, - new_ctx->token = subflow_req->token; - new_ctx->ssn_offset = subflow_req->ssn_offset; - new_ctx->idsn = subflow_req->idsn; -+ -+ /* this is the first subflow, id is always 0 */ -+ new_ctx->local_id_valid = 1; - } else if (subflow_req->mp_join) { - new_ctx->ssn_offset = subflow_req->ssn_offset; - new_ctx->mp_join = 1; - new_ctx->fully_established = 1; - new_ctx->backup = subflow_req->backup; -- new_ctx->local_id = subflow_req->local_id; - new_ctx->remote_id = subflow_req->remote_id; - new_ctx->token = subflow_req->token; - new_ctx->thmac = subflow_req->thmac; -+ -+ /* the subflow req id is valid, fetched via subflow_check_req() -+ * and subflow_token_join_request() -+ */ -+ subflow_set_local_id(new_ctx, subflow_req->local_id); - } - } - -@@ -1798,6 +1844,7 @@ void __init mptcp_subflow_init(void) - subflow_specific.conn_request = subflow_v4_conn_request; - subflow_specific.syn_recv_sock = subflow_syn_recv_sock; - subflow_specific.sk_rx_dst_set = subflow_finish_connect; -+ subflow_specific.rebuild_header = subflow_rebuild_header; - - tcp_prot_override = tcp_prot; - tcp_prot_override.release_cb = tcp_release_cb_override; -@@ -1810,6 +1857,7 @@ void __init mptcp_subflow_init(void) - subflow_v6_specific.conn_request = subflow_v6_conn_request; - subflow_v6_specific.syn_recv_sock = subflow_syn_recv_sock; - subflow_v6_specific.sk_rx_dst_set = subflow_finish_connect; -+ subflow_v6_specific.rebuild_header = subflow_v6_rebuild_header; - - subflow_v6m_specific = subflow_v6_specific; - subflow_v6m_specific.queue_xmit = ipv4_specific.queue_xmit; -@@ -1817,6 +1865,7 @@ void __init mptcp_subflow_init(void) - subflow_v6m_specific.net_header_len = ipv4_specific.net_header_len; - subflow_v6m_specific.mtu_reduced = ipv4_specific.mtu_reduced; - subflow_v6m_specific.net_frag_header_len = 0; -+ subflow_v6m_specific.rebuild_header = subflow_rebuild_header; - - tcpv6_prot_override = tcpv6_prot; - tcpv6_prot_override.release_cb = tcp_release_cb_override; --- -2.35.1 - diff --git a/queue-5.17/series b/queue-5.17/series index 93137a61ce1..5ba7fb1fd1d 100644 --- a/queue-5.17/series +++ b/queue-5.17/series @@ -112,8 +112,6 @@ arm-9196-1-spectre-bhb-enable-for-cortex-a15.patch arm-9197-1-spectre-bhb-fix-loop8-sequence-for-thumb2.patch lockdown-also-lock-down-previous-kgdb-use.patch mptcp-fix-checksum-byte-order.patch -mptcp-strict-local-address-id-selection.patch -mptcp-do-tcp-fallback-on-early-dss-checksum-failure.patch igb-skip-phy-status-check-where-unavailable.patch netfilter-flowtable-fix-tcp-flow-teardown.patch netfilter-flowtable-pass-flowtable-to-nf_flow_table_.patch