diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 04c4cba5df12a..ccf8788054255 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2344,11 +2344,9 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, unsigned int flags) { struct mptcp_sock *msk = mptcp_sk(sk); - bool need_push, dispose_it; + bool need_push; - dispose_it = !msk->subflow || ssk != msk->subflow->sk; - if (dispose_it) - list_del(&subflow->node); + list_del(&subflow->node); lock_sock_nested(ssk, SINGLE_DEPTH_NESTING); @@ -2362,15 +2360,6 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, } need_push = (flags & MPTCP_CF_PUSH) && __mptcp_retransmit_pending_data(sk); - if (!dispose_it) { - tcp_disconnect(ssk, 0); - msk->subflow->state = SS_UNCONNECTED; - mptcp_subflow_ctx_reset(subflow); - release_sock(ssk); - - goto out; - } - sock_orphan(ssk); subflow->disposable = 1; @@ -2397,10 +2386,11 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk, sock_put(ssk); - if (ssk == msk->first) + if (ssk == msk->first) { msk->first = NULL; + mptcp_dispose_initial_subflow(msk); + } -out: if (ssk == msk->last_snd) msk->last_snd = NULL; @@ -3224,10 +3214,6 @@ static void mptcp_destroy(struct sock *sk) { struct mptcp_sock *msk = mptcp_sk(sk); - /* clears msk->subflow, allowing the following to close - * even the initial subflow - */ - mptcp_dispose_initial_subflow(msk); mptcp_destroy_common(msk, 0); sk_sockets_allocated_dec(sk); }