From: Sowmini Varadhan Date: Wed, 7 Jun 2017 21:09:38 +0000 (-0700) Subject: rds: tcp: fix memory leak in TIME_WAIT sockets X-Git-Tag: v4.1.12-104.0.20170618_1145~212 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3235fef9a6f8501079f8c899f392b5daf06c2db4;p=users%2Fjedix%2Flinux-maple.git 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 --- 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);