linux/net/mptcp
Matthieu Baerts (NGI0) d82809b6c5 mptcp: avoid duplicated SUB_CLOSED events
The initial subflow might have already been closed, but still in the
connection list. When the worker is instructed to close the subflows
that have been marked as closed, it might then try to close the initial
subflow again.

 A consequence of that is that the SUB_CLOSED event can be seen twice:

  # ip mptcp endpoint
  1.1.1.1 id 1 subflow dev eth0
  2.2.2.2 id 2 subflow dev eth1

  # ip mptcp monitor &
  [         CREATED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9
  [     ESTABLISHED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9
  [  SF_ESTABLISHED] remid=0 locid=2 saddr4=2.2.2.2 daddr4=9.9.9.9

  # ip mptcp endpoint delete id 1
  [       SF_CLOSED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9
  [       SF_CLOSED] remid=0 locid=0 saddr4=1.1.1.1 daddr4=9.9.9.9

The first one is coming from mptcp_pm_nl_rm_subflow_received(), and the
second one from __mptcp_close_subflow().

To avoid doing the post-closed processing twice, the subflow is now
marked as closed the first time.

Note that it is not enough to check if we are dealing with the first
subflow and check its sk_state: the subflow might have been reset or
closed before calling mptcp_close_ssk().

Fixes: b911c97c7d ("mptcp: add netlink event support")
Cc: stable@vger.kernel.org
Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-08-29 10:39:50 +02:00
..
bpf.c bpf: Add update_socket_protocol hook 2023-08-16 10:22:16 -07:00
crypto_test.c mptcp: fill in missing MODULE_DESCRIPTION() 2023-12-17 20:54:22 +00:00
crypto.c kunit: mptcp: adhere to KUNIT formatting standard 2021-04-16 17:10:40 -07:00
ctrl.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
diag.c mptcp: correct MPTCP_SUBFLOW_ATTR_SSN_OFFSET reserved size 2024-08-13 19:13:25 -07:00
fastopen.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
Kconfig kunit: mptcp: adhere to KUNIT formatting standard 2021-04-16 17:10:40 -07:00
Makefile net: mptcp: use policy generated by YAML spec 2023-10-24 13:00:32 -07:00
mib.c mptcp: mib: count MPJ with backup flag 2024-07-30 10:27:30 +02:00
mib.h mptcp: mib: count MPJ with backup flag 2024-07-30 10:27:30 +02:00
mptcp_diag.c mptcp: drop duplicate header inclusions 2024-03-06 20:24:10 -08:00
mptcp_pm_gen.c mptcp: add token for get-addr in yaml 2024-03-04 13:07:45 +00:00
mptcp_pm_gen.h mptcp: add token for get-addr in yaml 2024-03-04 13:07:45 +00:00
options.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
pm_netlink.c mptcp: pm: fix ID 0 endp usage after multiple re-creations 2024-08-29 10:39:50 +02:00
pm_userspace.c mptcp: pm: fix backup support in signal endpoints 2024-07-30 10:27:30 +02:00
pm.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
protocol.c mptcp: avoid duplicated SUB_CLOSED events 2024-08-29 10:39:50 +02:00
protocol.h mptcp: avoid duplicated SUB_CLOSED events 2024-08-29 10:39:50 +02:00
sched.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
sockopt.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
subflow.c mptcp: pr_debug: add missing \n at the end 2024-08-27 14:45:16 -07:00
syncookies.c mptcp: don't return sockets in foreign netns 2021-09-24 10:51:36 +01:00
token_test.c mptcp: token kunit: set protocol 2024-02-26 18:42:12 -08:00
token.c mptcp: add statistics for mptcp socket in use 2023-01-09 07:30:50 +00:00