aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 432c36649db3..609ff98aeb47 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4529,6 +4529,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size)
4529 struct tcphdr *th; 4529 struct tcphdr *th;
4530 bool fragstolen; 4530 bool fragstolen;
4531 4531
4532 if (size == 0)
4533 return 0;
4534
4532 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); 4535 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
4533 if (!skb) 4536 if (!skb)
4534 goto err; 4537 goto err;
@@ -5310,11 +5313,6 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
5310 goto discard; 5313 goto discard;
5311 } 5314 }
5312 5315
5313 /* ts_recent update must be made after we are sure that the packet
5314 * is in window.
5315 */
5316 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5317
5318 /* step 3: check security and precedence [ignored] */ 5316 /* step 3: check security and precedence [ignored] */
5319 5317
5320 /* step 4: Check for a SYN 5318 /* step 4: Check for a SYN
@@ -5549,6 +5547,11 @@ step5:
5549 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5547 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)
5550 goto discard; 5548 goto discard;
5551 5549
5550 /* ts_recent update must be made after we are sure that the packet
5551 * is in window.
5552 */
5553 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5554
5552 tcp_rcv_rtt_measure_ts(sk, skb); 5555 tcp_rcv_rtt_measure_ts(sk, skb);
5553 5556
5554 /* Process urgent data. */ 5557 /* Process urgent data. */
@@ -5646,6 +5649,7 @@ static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack,
5646 tcp_rearm_rto(sk); 5649 tcp_rearm_rto(sk);
5647 return true; 5650 return true;
5648 } 5651 }
5652 tp->syn_data_acked = tp->syn_data;
5649 return false; 5653 return false;
5650} 5654}
5651 5655
@@ -5963,7 +5967,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5963 5967
5964 req = tp->fastopen_rsk; 5968 req = tp->fastopen_rsk;
5965 if (req != NULL) { 5969 if (req != NULL) {
5966 BUG_ON(sk->sk_state != TCP_SYN_RECV && 5970 WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
5967 sk->sk_state != TCP_FIN_WAIT1); 5971 sk->sk_state != TCP_FIN_WAIT1);
5968 5972
5969 if (tcp_check_req(sk, skb, req, NULL, true) == NULL) 5973 if (tcp_check_req(sk, skb, req, NULL, true) == NULL)
@@ -6052,7 +6056,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6052 * ACK we have received, this would have acknowledged 6056 * ACK we have received, this would have acknowledged
6053 * our SYNACK so stop the SYNACK timer. 6057 * our SYNACK so stop the SYNACK timer.
6054 */ 6058 */
6055 if (acceptable && req != NULL) { 6059 if (req != NULL) {
6060 /* Return RST if ack_seq is invalid.
6061 * Note that RFC793 only says to generate a
6062 * DUPACK for it but for TCP Fast Open it seems
6063 * better to treat this case like TCP_SYN_RECV
6064 * above.
6065 */
6066 if (!acceptable)
6067 return 1;
6056 /* We no longer need the request sock. */ 6068 /* We no longer need the request sock. */
6057 reqsk_fastopen_remove(sk, req, false); 6069 reqsk_fastopen_remove(sk, req, false);
6058 tcp_rearm_rto(sk); 6070 tcp_rearm_rto(sk);
@@ -6118,6 +6130,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6118 } else 6130 } else
6119 goto discard; 6131 goto discard;
6120 6132
6133 /* ts_recent update must be made after we are sure that the packet
6134 * is in window.
6135 */
6136 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
6137
6121 /* step 6: check the URG bit */ 6138 /* step 6: check the URG bit */
6122 tcp_urg(sk, skb, th); 6139 tcp_urg(sk, skb, th);
6123 6140