Skip to content

Commit fe94800

Browse files
menglongdongkuba-moo
authored andcommitted
mptcp: don't orphan ssk in mptcp_close()
All of the subflows of a msk will be orphaned in mptcp_close(), which means the subflows are in DEAD state. After then, DATA_FIN will be sent, and the other side will response with a DATA_ACK for this DATA_FIN. However, if the other side still has pending data, the data that received on these subflows will not be passed to the msk, as they are DEAD and subflow_data_ready() will not be called in tcp_data_ready(). Therefore, these data can't be acked, and they will be retransmitted again and again, until timeout. Fix this by setting ssk->sk_socket and ssk->sk_wq to 'NULL', instead of orphaning the subflows in __mptcp_close(), as Paolo suggested. Fixes: e16163b ("mptcp: refactor shutdown and close") Reviewed-by: Biao Jiang <[email protected]> Reviewed-by: Mengen Sun <[email protected]> Signed-off-by: Menglong Dong <[email protected]> Reviewed-by: Paolo Abeni <[email protected]> Signed-off-by: Matthieu Baerts <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 39f59bc commit fe94800

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

net/mptcp/protocol.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2354,12 +2354,7 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
23542354
goto out;
23552355
}
23562356

2357-
/* if we are invoked by the msk cleanup code, the subflow is
2358-
* already orphaned
2359-
*/
2360-
if (ssk->sk_socket)
2361-
sock_orphan(ssk);
2362-
2357+
sock_orphan(ssk);
23632358
subflow->disposable = 1;
23642359

23652360
/* if ssk hit tcp_done(), tcp_cleanup_ulp() cleared the related ops
@@ -2940,7 +2935,11 @@ bool __mptcp_close(struct sock *sk, long timeout)
29402935
if (ssk == msk->first)
29412936
subflow->fail_tout = 0;
29422937

2943-
sock_orphan(ssk);
2938+
/* detach from the parent socket, but allow data_ready to
2939+
* push incoming data into the mptcp stack, to properly ack it
2940+
*/
2941+
ssk->sk_socket = NULL;
2942+
ssk->sk_wq = NULL;
29442943
unlock_sock_fast(ssk, slow);
29452944
}
29462945
sock_orphan(sk);

0 commit comments

Comments
 (0)