lkml.org 
[lkml]   [2022]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 58/88] tcp: Fix data-races around sk_pacing_rate.
    Date
    From: Kuniyuki Iwashima <kuniyu@amazon.com>

    [ Upstream commit 59bf6c65a09fff74215517aecffbbdcd67df76e3 ]

    While reading sysctl_tcp_pacing_(ss|ca)_ratio, they can be changed
    concurrently. Thus, we need to add READ_ONCE() to their readers.

    Fixes: 43e122b014c9 ("tcp: refine pacing rate determination")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    net/ipv4/tcp_input.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
    index db78197a44ff..de066fad7dfe 100644
    --- a/net/ipv4/tcp_input.c
    +++ b/net/ipv4/tcp_input.c
    @@ -910,9 +910,9 @@ static void tcp_update_pacing_rate(struct sock *sk)
    * end of slow start and should slow down.
    */
    if (tcp_snd_cwnd(tp) < tp->snd_ssthresh / 2)
    - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio;
    + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ss_ratio);
    else
    - rate *= sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio;
    + rate *= READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_pacing_ca_ratio);

    rate *= max(tcp_snd_cwnd(tp), tp->packets_out);

    --
    2.35.1


    \
     
     \ /
      Last update: 2022-08-01 14:17    [W:2.122 / U:0.100 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site