aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_minisocks.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2019-10-10 23:17:42 -0400
committerDavid S. Miller <davem@davemloft.net>2019-10-13 13:13:08 -0400
commite0d694d638dba768b47be31c22e1a9b4f862f561 (patch)
treec35cd9fe92b9008fda870b5ae83b3971e6632a60 /net/ipv4/tcp_minisocks.c
parent0f31746452e6793ad6271337438af8f4defb8940 (diff)
tcp: annotate tp->snd_nxt lockless reads
There are few places where we fetch tp->snd_nxt while this field can change from IRQ or other cpu. We need to add READ_ONCE() annotations, and also make sure write sides use corresponding WRITE_ONCE() to avoid store-tearing. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_minisocks.c')
-rw-r--r--net/ipv4/tcp_minisocks.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 339944690329..c802bc80c400 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -482,8 +482,10 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
482 WRITE_ONCE(newtp->rcv_nxt, seq); 482 WRITE_ONCE(newtp->rcv_nxt, seq);
483 newtp->segs_in = 1; 483 newtp->segs_in = 1;
484 484
485 newtp->snd_sml = newtp->snd_una = 485 seq = treq->snt_isn + 1;
486 newtp->snd_nxt = newtp->snd_up = treq->snt_isn + 1; 486 newtp->snd_sml = newtp->snd_una = seq;
487 WRITE_ONCE(newtp->snd_nxt, seq);
488 newtp->snd_up = seq;
487 489
488 INIT_LIST_HEAD(&newtp->tsq_node); 490 INIT_LIST_HEAD(&newtp->tsq_node);
489 INIT_LIST_HEAD(&newtp->tsorted_sent_queue); 491 INIT_LIST_HEAD(&newtp->tsorted_sent_queue);