linux/net/mptcp
Arthur Mongodin 2c1f97a52c mptcp: Fix data stream corruption in the address announcement
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>
2025-03-20 15:12:22 +01:00
..
Kconfig
Makefile net: mptcp: use policy generated by YAML spec 2023-10-24 13:00:32 -07:00
bpf.c
crypto.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
crypto_test.c mptcp: fill in missing MODULE_DESCRIPTION() 2023-12-17 20:54:22 +00:00
ctrl.c mptcp: blackhole only if 1st SYN retrans w/o MPC is accepted 2025-01-30 14:02:19 +01:00
diag.c mptcp: annotate data-races around subflow->fully_established 2024-10-28 15:55:45 -07:00
fastopen.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
mib.c mptcp: prevent MPC handshake on port-based signal endpoints 2024-10-15 10:57:02 -07:00
mib.h mptcp: prevent MPC handshake on port-based signal endpoints 2024-10-15 10:57:02 -07:00
mptcp_diag.c mptcp: drop duplicate header inclusions 2024-03-06 20:24:10 -08:00
mptcp_pm_gen.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-11-07 13:44:16 -08:00
mptcp_pm_gen.h mptcp: add token for get-addr in yaml 2024-03-04 13:07:45 +00:00
options.c mptcp: Fix data stream corruption in the address announcement 2025-03-20 15:12:22 +01:00
pm.c mptcp: implement mptcp_pm_connection_closed 2024-10-28 15:55:45 -07:00
pm_netlink.c mptcp: fix 'scheduling while atomic' in mptcp_pm_nl_append_new_local_addr 2025-03-04 17:24:48 -08:00
pm_userspace.c mptcp: fix for setting remote ipv4mapped address 2025-01-15 13:19:04 -08:00
protocol.c mptcp: handle fastopen disconnect correctly 2025-01-27 15:07:02 -08:00
protocol.h mptcp: safety check before fallback 2025-02-25 18:34:37 -08:00
sched.c mptcp: remove unneeded lock when listing scheds 2024-11-05 17:54:39 -08:00
sockopt.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
subflow.c mptcp: reset when MPTCP opts are dropped after join 2025-02-25 18:34:36 -08:00
syncookies.c
token.c
token_test.c mptcp: token kunit: set protocol 2024-02-26 18:42:12 -08:00