]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
rds: tcp: fix memory leak in TIME_WAIT sockets
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Wed, 7 Jun 2017 21:09:38 +0000 (14:09 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Sat, 10 Jun 2017 00:51:01 +0000 (17:51 -0700)
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 <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
net/rds/tcp_listen.c

index 0e179f127081a5229aebae22b85243c96dff536c..98a0ad918059a35379d81fa680b599cc8c606a81 100644 (file)
@@ -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);