diff options
author | Paolo Abeni <pabeni@redhat.com> | 2022-05-13 01:26:41 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-05-14 02:04:30 +0200 |
commit | 95d686517884a403412b000361cee2b08b2ed1e6 (patch) | |
tree | 3cedfc5c31871fc58581ca09618d1b71ee8cf5c8 /net/mptcp/subflow.c | |
parent | Revert "tcp/dccp: get rid of inet_twsk_purge()" (diff) | |
download | linux-95d686517884a403412b000361cee2b08b2ed1e6.tar.xz linux-95d686517884a403412b000361cee2b08b2ed1e6.zip |
mptcp: fix subflow accounting on close
If the PM closes a fully established MPJ subflow or the subflow
creation errors out in it's early stage the subflows counter is
not bumped accordingly.
This change adds the missing accounting, additionally taking care
of updating accordingly the 'accept_subflow' flag.
Fixes: a88c9e496937 ("mptcp: do not block subflows creation on errors")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/subflow.c')
-rw-r--r-- | net/mptcp/subflow.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index aba260f547da..8c37087f0d84 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1422,20 +1422,20 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, struct sockaddr_storage addr; int remote_id = remote->id; int local_id = loc->id; + int err = -ENOTCONN; struct socket *sf; struct sock *ssk; u32 remote_token; int addrlen; int ifindex; u8 flags; - int err; if (!mptcp_is_fully_established(sk)) - return -ENOTCONN; + goto err_out; err = mptcp_subflow_create_socket(sk, &sf); if (err) - return err; + goto err_out; ssk = sf->sk; subflow = mptcp_subflow_ctx(ssk); @@ -1492,6 +1492,12 @@ failed_unlink: failed: subflow->disposable = 1; sock_release(sf); + +err_out: + /* we account subflows before the creation, and this failures will not + * be caught by sk_state_change() + */ + mptcp_pm_close_subflow(msk); return err; } |