From: Sowmini Varadhan Date: Mon, 6 Jun 2016 21:47:18 +0000 (-0700) Subject: RDS: TCP: Avoid rds connection churn from rogue SYNs X-Git-Tag: v4.1.12-92~87^2~20 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c4e3bd6deaee652f72faa437a6ee8761c985e793;p=users%2Fjedix%2Flinux-maple.git RDS: TCP: Avoid rds connection churn from rogue SYNs Orabug: 23542064 Backport of upstream commmit c948bb5c2cc4 ("RDS: TCP: Avoid rds connection churn from rogue SYNs") When a rogue SYN is received after the connection arbitration algorithm has converged, the incoming SYN should not needlessly quiesce the transmit path, and it should not result in needless TCP connection resets due to re-execution of the connection arbitration logic. Signed-off-by: Sowmini Varadhan Acked-by: Santosh Shilimkar Signed-off-by: David S. Miller --- diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c index 38a6df62cdb7d..5c82e4cbd02f1 100644 --- a/net/rds/tcp_listen.c +++ b/net/rds/tcp_listen.c @@ -131,12 +131,13 @@ int rds_tcp_accept_one(struct socket *sock) * so we must quiesce any send threads before resetting * c_transport_data. */ - atomic_set(&conn->c_state, RDS_CONN_CONNECTING); - wait_event(conn->c_waitq, - !test_bit(RDS_IN_XMIT, &conn->c_flags)); - if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr)) { + if (ntohl(inet->inet_saddr) < ntohl(inet->inet_daddr) || + !conn->c_outgoing) { goto rst_nsk; - } else if (rs_tcp->t_sock) { + } else { + atomic_set(&conn->c_state, RDS_CONN_CONNECTING); + wait_event(conn->c_waitq, + !test_bit(RDS_IN_XMIT, &conn->c_flags)); rds_tcp_restore_callbacks(rs_tcp->t_sock, rs_tcp); conn->c_outgoing = 0; }