@@ -555,7 +555,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
555555 newtp -> max_window = newtp -> snd_wnd ;
556556
557557 if (newtp -> rx_opt .tstamp_ok ) {
558- newtp -> rx_opt .ts_recent = req -> ts_recent ;
558+ newtp -> rx_opt .ts_recent = READ_ONCE ( req -> ts_recent ) ;
559559 newtp -> rx_opt .ts_recent_stamp = ktime_get_seconds ();
560560 newtp -> tcp_header_len = sizeof (struct tcphdr ) + TCPOLEN_TSTAMP_ALIGNED ;
561561 } else {
@@ -619,7 +619,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
619619 tcp_parse_options (sock_net (sk ), skb , & tmp_opt , 0 , NULL );
620620
621621 if (tmp_opt .saw_tstamp ) {
622- tmp_opt .ts_recent = req -> ts_recent ;
622+ tmp_opt .ts_recent = READ_ONCE ( req -> ts_recent ) ;
623623 if (tmp_opt .rcv_tsecr )
624624 tmp_opt .rcv_tsecr -= tcp_rsk (req )-> ts_off ;
625625 /* We do not store true stamp, but it is not required,
@@ -758,8 +758,11 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
758758
759759 /* In sequence, PAWS is OK. */
760760
761+ /* TODO: We probably should defer ts_recent change once
762+ * we take ownership of @req.
763+ */
761764 if (tmp_opt .saw_tstamp && !after (TCP_SKB_CB (skb )-> seq , tcp_rsk (req )-> rcv_nxt ))
762- req -> ts_recent = tmp_opt .rcv_tsval ;
765+ WRITE_ONCE ( req -> ts_recent , tmp_opt .rcv_tsval ) ;
763766
764767 if (TCP_SKB_CB (skb )-> seq == tcp_rsk (req )-> rcv_isn ) {
765768 /* Truncate SYN, it is out of window starting
0 commit comments