Commit 96a9fa7f authored by Matthieu Baerts (NGI0)'s avatar Matthieu Baerts (NGI0) Committed by ZhangPeng
Browse files

mptcp: distinguish rcv vs sent backup flag in requests

stable inclusion
from stable-v6.6.45
commit 8ed3e34c766e8264d5d2e0436f86c51604d6a8a7
bugzilla: https://gitee.com/openeuler/kernel/issues/IAJEIR

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8ed3e34c766e8264d5d2e0436f86c51604d6a8a7



--------------------------------

commit efd340bf3d7779a3a8ec954d8ec0fb8a10f24982 upstream.

When sending an MP_JOIN + SYN + ACK, it is possible to mark the subflow
as 'backup' by setting the flag with the same name. Before this patch,
the backup was set if the other peer set it in its MP_JOIN + SYN
request.

It is not correct: the backup flag should be set in the MPJ+SYN+ACK only
if the host asks for it, and not mirroring what was done by the other
peer. It is then required to have a dedicated bit for each direction,
similar to what is done in the subflow context.

Fixes: f296234c ("mptcp: Add handling of incoming MP_JOIN requests")
Cc: stable@vger.kernel.org
Reviewed-by: default avatarMat Martineau <martineau@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
parent de435edf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -909,7 +909,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
		return true;
	} else if (subflow_req->mp_join) {
		opts->suboptions = OPTION_MPTCP_MPJ_SYNACK;
		opts->backup = subflow_req->backup;
		opts->backup = subflow_req->request_bkup;
		opts->join_id = subflow_req->local_id;
		opts->thmac = subflow_req->thmac;
		opts->nonce = subflow_req->local_nonce;
+1 −0
Original line number Diff line number Diff line
@@ -423,6 +423,7 @@ struct mptcp_subflow_request_sock {
	u16	mp_capable : 1,
		mp_join : 1,
		backup : 1,
		request_bkup : 1,
		csum_reqd : 1,
		allow_join_id0 : 1;
	u8	local_id;
+1 −0
Original line number Diff line number Diff line
@@ -1978,6 +1978,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
		new_ctx->fully_established = 1;
		new_ctx->remote_key_valid = 1;
		new_ctx->backup = subflow_req->backup;
		new_ctx->request_bkup = subflow_req->request_bkup;
		WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id);
		new_ctx->token = subflow_req->token;
		new_ctx->thmac = subflow_req->thmac;