From 3235fef9a6f8501079f8c899f392b5daf06c2db4 Mon Sep 17 00:00:00 2001 From: Sowmini Varadhan Date: Wed, 7 Jun 2017 14:09:38 -0700 Subject: [PATCH] rds: tcp: fix memory leak in TIME_WAIT sockets Due to a toxic cocktail of an endian-ness bug, plus some other changes in mprds to make sure that the side with the numerically smaller address must initiate the tcp connection, end result is an infinite connection attempt and a memory leak in TIME_WAIT sockets. Orabug: 26250066 Signed-off-by: Sowmini Varadhan Acked-by: Santosh Shilimkar --- net/rds/tcp_listen.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 0e179f127081a..98a0ad918059a 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -162,21 +162,13 @@ int rds_tcp_accept_one(struct socket *sock) if (conn_state != RDS_CONN_CONNECTING && conn_state != RDS_CONN_ERROR) goto rst_nsk; if (rs_tcp->t_sock) { - /* Need to resolve a duelling SYN between peers. - * We have an outstanding SYN to this peer, which may - * potentially have transitioned to the RDS_CONN_UP state, - * so we must quiesce any send threads before resetting - * c_transport_data. + /* Duelling SYN resolution has already been done in + * rds_tcp_accept_one_path. */ - if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr) || - !cp->cp_outgoing) { - goto rst_nsk; - } else { - rds_tcp_reset_callbacks(new_sock, cp); - cp->cp_outgoing = 0; - /* rds_connect_path_complete() marks RDS_CONN_UP */ - rds_connect_path_complete(cp, RDS_CONN_RESETTING); - } + rds_tcp_reset_callbacks(new_sock, cp); + cp->cp_outgoing = 0; + /* rds_connect_path_complete() marks RDS_CONN_UP */ + rds_connect_path_complete(cp, RDS_CONN_RESETTING); } else { rds_tcp_set_callbacks(new_sock, cp); rds_connect_path_complete(cp, RDS_CONN_CONNECTING); -- 2.50.1