Skip to content

Commit

Permalink
mptcp: plug subflow context memory leak
Browse files Browse the repository at this point in the history
When a MPTCP listener socket is closed with unaccepted
children pending, the ULP release callback will be invoked,
but nobody will call into __mptcp_close_ssk() on the
corresponding subflow.

As a consequence, at ULP release time, the 'disposable' flag
will be cleared and the subflow context memory will be leaked.

This change addresses the issue always freeing the context if
the subflow is still in the accept queue at ULP release time.

Additionally, this fixes an incorrect code reference in the
related comment.

Note: this fix leverages the changes introduced by the previous
commit.

Fixes: e16163b ("mptcp: refactor shutdown and close")
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Paolo Abeni authored and jenkins-tessares committed Dec 9, 2020
1 parent ae1cd5e commit 9910201
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,9 +1339,10 @@ static void subflow_ulp_release(struct sock *ssk)
sk = ctx->conn;
if (sk) {
/* if the msk has been orphaned, keep the ctx
* alive, will be freed by mptcp_done()
* alive, will be freed by __mptcp_close_ssk(),
* when the subflow is still unaccepted
*/
release = ctx->disposable;
release = ctx->disposable || list_empty(&ctx->node);
sock_put(sk);
}

Expand Down

0 comments on commit 9910201

Please sign in to comment.