Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
mptcp: Fix error-case when in hash-dance
Browse files Browse the repository at this point in the history
inet_csk_complete_hashdance() can still fail, if the listener gets
closed before everything completed. In that case, we need to clean
things up properly by making a sock_put() on the child and unlocking the
meta.

Fixes: b568f57 ("Merge tag 'v4.4' into mptcp_trunk")
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
(cherry picked from commit 053fce1)
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
  • Loading branch information
cpaasch authored and matttbe committed May 29, 2019
1 parent 725ea4f commit ea0df99
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion net/mptcp/mptcp_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,17 @@ int mptcp_check_req_master(struct sock *sk, struct sock *child,
*/
if (drop) {
tcp_synack_rtt_meas(child, req);
inet_csk_complete_hashdance(sk, meta_sk, req, true);

inet_csk_reqsk_queue_drop(sk, req);
reqsk_queue_removed(&inet_csk(sk)->icsk_accept_queue, req);
if (!inet_csk_reqsk_queue_add(sk, req, meta_sk)) {
bh_unlock_sock(meta_sk);
/* No sock_put() of the meta needed. The reference has
* already been dropped in __mptcp_check_req_master().
*/
sock_put(child);
return -1;
}
} else {
/* Thus, we come from syn-cookies */
refcount_set(&req->rsk_refcnt, 1);
Expand Down

0 comments on commit ea0df99

Please sign in to comment.