mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-20 17:41:09 +00:00
tcp: annotate data races around tp->mtu_info
commit561022acb1
upstream. While tp->mtu_info is read while socket is owned, the write sides happen from err handlers (tcp_v[46]_mtu_reduced) which only own the socket spinlock. Fixes:563d34d057
("tcp: dont drop MTU reduction indications") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
19f51c2529
commit
f7c6f21aaa
2 changed files with 4 additions and 4 deletions
|
@ -285,7 +285,7 @@ void tcp_v4_mtu_reduced(struct sock *sk)
|
||||||
|
|
||||||
if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
|
if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
|
||||||
return;
|
return;
|
||||||
mtu = tcp_sk(sk)->mtu_info;
|
mtu = READ_ONCE(tcp_sk(sk)->mtu_info);
|
||||||
dst = inet_csk_update_pmtu(sk, mtu);
|
dst = inet_csk_update_pmtu(sk, mtu);
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return;
|
return;
|
||||||
|
@ -453,7 +453,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
|
||||||
if (sk->sk_state == TCP_LISTEN)
|
if (sk->sk_state == TCP_LISTEN)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tp->mtu_info = info;
|
WRITE_ONCE(tp->mtu_info, info);
|
||||||
if (!sock_owned_by_user(sk)) {
|
if (!sock_owned_by_user(sk)) {
|
||||||
tcp_v4_mtu_reduced(sk);
|
tcp_v4_mtu_reduced(sk);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -323,7 +323,7 @@ static void tcp_v6_mtu_reduced(struct sock *sk)
|
||||||
if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
|
if ((1 << sk->sk_state) & (TCPF_LISTEN | TCPF_CLOSE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dst = inet6_csk_update_pmtu(sk, tcp_sk(sk)->mtu_info);
|
dst = inet6_csk_update_pmtu(sk, READ_ONCE(tcp_sk(sk)->mtu_info));
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||||
if (!ip6_sk_accept_pmtu(sk))
|
if (!ip6_sk_accept_pmtu(sk))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
tp->mtu_info = ntohl(info);
|
WRITE_ONCE(tp->mtu_info, ntohl(info));
|
||||||
if (!sock_owned_by_user(sk))
|
if (!sock_owned_by_user(sk))
|
||||||
tcp_v6_mtu_reduced(sk);
|
tcp_v6_mtu_reduced(sk);
|
||||||
else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
|
else if (!test_and_set_bit(TCP_MTU_REDUCED_DEFERRED,
|
||||||
|
|
Loading…
Reference in a new issue