Skip to content

Commit

Permalink
mptcp: fix locking in mptcp_disconnect()
Browse files Browse the repository at this point in the history
tcp_disconnect() expects the caller acquires the sock lock,
but mptcp_disconnect() is not doing that. Add the missing
required lock.

Reported-by: Eric Dumazet <[email protected]>
Fixes: 76e2a55 ("mptcp: better msk-level shutdown.")
Signed-off-by: Paolo Abeni <[email protected]>
Link: https://lore.kernel.org/r/f818e82b58a556feeb71dcccc8bf1c87aafc6175.1610638176.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Paolo Abeni authored and kuba-moo committed Jan 14, 2021
1 parent 25537d7 commit 13a9499
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/mptcp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2646,8 +2646,13 @@ static int mptcp_disconnect(struct sock *sk, int flags)
struct mptcp_sock *msk = mptcp_sk(sk);

__mptcp_flush_join_list(msk);
mptcp_for_each_subflow(msk, subflow)
tcp_disconnect(mptcp_subflow_tcp_sock(subflow), flags);
mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow);

lock_sock(ssk);
tcp_disconnect(ssk, flags);
release_sock(ssk);
}
return 0;
}

Expand Down

0 comments on commit 13a9499

Please sign in to comment.