Skip to content

Commit 5282de1

Browse files
edumazetkuba-moo
authored andcommitted
tcp: remove READ_ONCE(req->ts_recent)
After commit 8d52da2 ("tcp: Defer ts_recent changes until req is owned"), req->ts_recent is not changed anymore. It is set once in tcp_openreq_init(), bpf_sk_assign_tcp_reqsk() or cookie_tcp_reqsk_alloc() before the req can be seen by other cpus/threads. This completes the revert of eba2081 ("tcp: annotate data-races around tcp_rsk(req)->ts_recent"). Signed-off-by: Eric Dumazet <[email protected]> Cc: Wang Hai <[email protected]> Reviewed-by: Jason Xing <[email protected]> Reviewed-by: Kuniyuki Iwashima <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9b49f57 commit 5282de1

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
11551155
tcp_rsk(req)->rcv_nxt,
11561156
tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale,
11571157
tcp_rsk_tsval(tcp_rsk(req)),
1158-
READ_ONCE(req->ts_recent),
1158+
req->ts_recent,
11591159
0, &key,
11601160
inet_rsk(req)->no_srccheck ? IP_REPLY_ARG_NOSRCCHECK : 0,
11611161
ip_hdr(skb)->tos,

net/ipv4/tcp_minisocks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
585585

586586
if (newtp->rx_opt.tstamp_ok) {
587587
newtp->tcp_usec_ts = treq->req_usec_ts;
588-
newtp->rx_opt.ts_recent = READ_ONCE(req->ts_recent);
588+
newtp->rx_opt.ts_recent = req->ts_recent;
589589
newtp->rx_opt.ts_recent_stamp = ktime_get_seconds();
590590
newtp->tcp_header_len = sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED;
591591
} else {
@@ -673,7 +673,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
673673
tcp_parse_options(sock_net(sk), skb, &tmp_opt, 0, NULL);
674674

675675
if (tmp_opt.saw_tstamp) {
676-
tmp_opt.ts_recent = READ_ONCE(req->ts_recent);
676+
tmp_opt.ts_recent = req->ts_recent;
677677
if (tmp_opt.rcv_tsecr) {
678678
if (inet_rsk(req)->tstamp_ok && !fastopen)
679679
tsecr_reject = !between(tmp_opt.rcv_tsecr,

net/ipv4/tcp_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ static unsigned int tcp_synack_options(const struct sock *sk,
949949
tcp_rsk(req)->snt_tsval_first = opts->tsval;
950950
}
951951
WRITE_ONCE(tcp_rsk(req)->snt_tsval_last, opts->tsval);
952-
opts->tsecr = READ_ONCE(req->ts_recent);
952+
opts->tsecr = req->ts_recent;
953953
remaining -= TCPOLEN_TSTAMP_ALIGNED;
954954
}
955955
if (likely(ireq->sack_ok)) {

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
12791279
tcp_rsk(req)->rcv_nxt,
12801280
tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale,
12811281
tcp_rsk_tsval(tcp_rsk(req)),
1282-
READ_ONCE(req->ts_recent), sk->sk_bound_dev_if,
1282+
req->ts_recent, sk->sk_bound_dev_if,
12831283
&key, ipv6_get_dsfield(ipv6_hdr(skb)), 0,
12841284
READ_ONCE(sk->sk_priority),
12851285
READ_ONCE(tcp_rsk(req)->txhash));

0 commit comments

Comments
 (0)