sst-linux/net/mptcp
Arthur Mongodin 4375eee347 mptcp: Fix data stream corruption in the address announcement
commit 2c1f97a52cb827a5f2768e67a9dddffae1ed47ab upstream.

Because of the size restriction in the TCP options space, the MPTCP
ADD_ADDR option is exclusive and cannot be sent with other MPTCP ones.
For this reason, in the linked mptcp_out_options structure, group of
fields linked to different options are part of the same union.

There is a case where the mptcp_pm_add_addr_signal() function can modify
opts->addr, but not ended up sending an ADD_ADDR. Later on, back in
mptcp_established_options, other options will be sent, but with
unexpected data written in other fields due to the union, e.g. in
opts->ext_copy. This could lead to a data stream corruption in the next
packet.

Using an intermediate variable, prevents from corrupting previously
established DSS option. The assignment of the ADD_ADDR option
parameters is now done once we are sure this ADD_ADDR option can be set
in the packet, e.g. after having dropped other suboptions.

Fixes: 1bff1e43a3 ("mptcp: optimize out option generation")
Cc: stable@vger.kernel.org
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Arthur Mongodin <amongodin@randorisec.fr>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
[ Matt: the commit message has been updated: long lines splits and some
  clarifications. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250314-net-mptcp-fix-data-stream-corr-sockopt-v1-1-122dbb249db3@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-28 21:59:01 +01:00
..
bpf.c
crypto_test.c
crypto.c
ctrl.c
diag.c mptcp: correct MPTCP_SUBFLOW_ATTR_SSN_OFFSET reserved size 2024-08-29 17:30:25 +02:00
Kconfig
Makefile
mib.c mptcp: prevent MPC handshake on port-based signal endpoints 2024-10-22 15:56:51 +02:00
mib.h mptcp: prevent MPC handshake on port-based signal endpoints 2024-10-22 15:56:51 +02:00
mptcp_diag.c
options.c mptcp: Fix data stream corruption in the address announcement 2025-03-28 21:59:01 +01:00
pm_netlink.c mptcp: fix 'scheduling while atomic' in mptcp_pm_nl_append_new_local_addr 2025-03-13 12:53:14 +01:00
pm_userspace.c mptcp: hold pm lock when deleting entry 2024-11-22 15:37:33 +01:00
pm.c mptcp: pr_debug: add missing \n at the end 2024-09-08 07:53:02 +02:00
protocol.c mptcp: prevent excessive coalescing on receive 2025-02-21 13:49:54 +01:00
protocol.h mptcp: safety check before fallback 2025-03-28 21:58:53 +01:00
sockopt.c mptcp: pr_debug: add missing \n at the end 2024-09-08 07:53:02 +02:00
subflow.c mptcp: reset when MPTCP opts are dropped after join 2025-03-07 16:56:50 +01:00
syncookies.c
token_test.c
token.c