netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: do not rearm rsk_timer on FastOpen requests
@ 2015-04-08 22:34 Eric Dumazet
  2015-04-09  0:22 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2015-04-08 22:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Yuchung Cheng

From: Eric Dumazet <edumazet@google.com>

FastOpen requests are not like other regular request sockets.

They do not yet use rsk_timer : tcp_fastopen_queue_check()
simply manually removes one expired request from fastopenq->rskq_rst
list.

Therefore, tcp_check_req() must not call mod_timer_pending(),
otherwise we crash because rsk_timer was not initialized.

Fixes: fa76ce7328b ("inet: get rid of central tcp/dccp listener timer")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
---
 net/ipv4/tcp_minisocks.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index d7003911c894075c209756a0ce26950a6a31aba4..2088fdcca14140f23aa01f60a1675c116f734a57 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -628,10 +628,16 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 					  LINUX_MIB_TCPACKSKIPPEDSYNRECV,
 					  &tcp_rsk(req)->last_oow_ack_time) &&
 
-		    !inet_rtx_syn_ack(sk, req))
-			mod_timer_pending(&req->rsk_timer, jiffies +
-				min(TCP_TIMEOUT_INIT << req->num_timeout,
-				    TCP_RTO_MAX));
+		    !inet_rtx_syn_ack(sk, req)) {
+			unsigned long expires = jiffies;
+
+			expires += min(TCP_TIMEOUT_INIT << req->num_timeout,
+				       TCP_RTO_MAX);
+			if (!fastopen)
+				mod_timer_pending(&req->rsk_timer, expires);
+			else
+				req->rsk_timer.expires = expires;
+		}
 		return NULL;
 	}
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tcp: do not rearm rsk_timer on FastOpen requests
  2015-04-08 22:34 [PATCH net-next] tcp: do not rearm rsk_timer on FastOpen requests Eric Dumazet
@ 2015-04-09  0:22 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-09  0:22 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, ycheng

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 08 Apr 2015 15:34:04 -0700

> From: Eric Dumazet <edumazet@google.com>
> 
> FastOpen requests are not like other regular request sockets.
> 
> They do not yet use rsk_timer : tcp_fastopen_queue_check()
> simply manually removes one expired request from fastopenq->rskq_rst
> list.
> 
> Therefore, tcp_check_req() must not call mod_timer_pending(),
> otherwise we crash because rsk_timer was not initialized.
> 
> Fixes: fa76ce7328b ("inet: get rid of central tcp/dccp listener timer")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Yuchung Cheng <ycheng@google.com>

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-09  0:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 22:34 [PATCH net-next] tcp: do not rearm rsk_timer on FastOpen requests Eric Dumazet
2015-04-09  0:22 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).