diff options
author | Paolo Abeni <pabeni@redhat.com> | 2021-01-14 16:37:37 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-01-14 20:25:21 +0100 |
commit | 13a9499e833387fcc7a53915bbe5cddf3c336b59 (patch) | |
tree | bdf5dd71ea6b3d74129b9d77a74be6ac3e5b1bf7 | |
parent | net: Allow NETIF_F_HW_TLS_TX if IP_CSUM && IPV6_CSUM (diff) | |
download | linux-13a9499e833387fcc7a53915bbe5cddf3c336b59.tar.xz linux-13a9499e833387fcc7a53915bbe5cddf3c336b59.zip |
mptcp: fix locking in mptcp_disconnect()
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 <eric.dumazet@gmail.com>
Fixes: 76e2a55d1625 ("mptcp: better msk-level shutdown.")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Link: https://lore.kernel.org/r/f818e82b58a556feeb71dcccc8bf1c87aafc6175.1610638176.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | net/mptcp/protocol.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 81faeff8f3bb..f998a077c7dd 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -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; } |