[PATCH net 4/4] mptcp: sockopt: increase seq in mptcp_setsockopt_all_sf

Matthieu Baerts (NGI0) posted 4 patches 1 month ago
[PATCH net 4/4] mptcp: sockopt: increase seq in mptcp_setsockopt_all_sf
Posted by Matthieu Baerts (NGI0) 1 month ago
mptcp_setsockopt_all_sf() was missing a call to sockopt_seq_inc(). This
is required not to cause missing synchronization for newer subflows
created later on.

This helper is called each time a socket option is set on subflows, and
future ones will need to inherit this option after their creation.

Fixes: 51c5fd09e1b4 ("mptcp: add TCP_MAXSEG sockopt support")
Cc: stable@vger.kernel.org
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/sockopt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index 0efe40be2fde..1cf608e7357b 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -812,6 +812,10 @@ static int mptcp_setsockopt_all_sf(struct mptcp_sock *msk, int level,
 		if (ret)
 			break;
 	}
+
+	if (!ret)
+		sockopt_seq_inc(msk);
+
 	return ret;
 }
 

-- 
2.53.0
Re: [PATCH net 4/4] mptcp: sockopt: increase seq in mptcp_setsockopt_all_sf
Posted by Matthieu Baerts 1 month ago
Hello,

On 01/05/2026 21:35, Matthieu Baerts (NGI0) wrote:
> mptcp_setsockopt_all_sf() was missing a call to sockopt_seq_inc(). This
> is required not to cause missing synchronization for newer subflows
> created later on.
> 
> This helper is called each time a socket option is set on subflows, and
> future ones will need to inherit this option after their creation.

Regarding Sashiko's review, I think this can be ignored: the comments
are about existing code / architecture. In short, for the moment, most
places in sockopt.c assumes that if there is an error to set a socket
option with one subflow, the error will be visible when setting this
option on all of them. Maybe (not sure) this could be changed, but then
this can be done later, when modifying all the other places. Here I
think it is better to keep the same logic as what is done with the other
options.

https://sashiko.dev/#/patchset/20260501-net-mptcp-misc-fixes-7-1-rc3-v1-0-b70118df778e%40kernel.org

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.