mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
tcp: annotate data-races on tp->segs_in and tp->data_segs_in
tcp_segs_in() can be called from BH, while socket spinlock is held but socket owned by user, eventually reading these fields from tcp_get_info() Found by code inspection, no need to backport this patch to older kernels. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d2489c7b6d
commit
0307a0b74b
2 changed files with 10 additions and 4 deletions
|
@ -2172,9 +2172,13 @@ static inline void tcp_segs_in(struct tcp_sock *tp, const struct sk_buff *skb)
|
|||
u16 segs_in;
|
||||
|
||||
segs_in = max_t(u16, 1, skb_shinfo(skb)->gso_segs);
|
||||
tp->segs_in += segs_in;
|
||||
|
||||
/* We update these fields while other threads might
|
||||
* read them from tcp_get_info()
|
||||
*/
|
||||
WRITE_ONCE(tp->segs_in, tp->segs_in + segs_in);
|
||||
if (skb->len > tcp_hdrlen(skb))
|
||||
tp->data_segs_in += segs_in;
|
||||
WRITE_ONCE(tp->data_segs_in, tp->data_segs_in + segs_in);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue