Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1957418imn; Mon, 1 Aug 2022 06:17:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXEQXD+TELRtllU6a8jqrsRq7b6dX4qK5DvzvVFGjzXVHcMZt1DyMlak93Xp0uuQFyukVu X-Received: by 2002:a63:d809:0:b0:415:5265:687c with SMTP id b9-20020a63d809000000b004155265687cmr13673292pgh.372.1659359843975; Mon, 01 Aug 2022 06:17:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659359843; cv=none; d=google.com; s=arc-20160816; b=k0oSpSbsW1jYLBbd/TL6PuJbXrXpuQMq2VHGtB/gP/L/I7CTeijM7joxgwtvr7zGsF aSFqydjhYuL4Abf2JDXlZuNOyWdf++3XTKOzlhfQD8G7KdyahED2JmXEwVnTwaVx0aw1 9VZVG5XOfFJ7oXNxfEfcHVwoDrK3MJVV8jmu06/WFLWkbng7ABPjj/n0KF7ao6A6zX0m hRNrtS3ytb5Wm8Qxt96uv4JSHeFbhakzU4uMse9JHdsyJaj6Z9BLLu3xZXYPqlzNcaNl k9yiFXoGp4Qx+vQ0GpZfsr5/LMHl1dcKC5dGKNOwi90ryFrXtHBJbgdWFzR/oGlQD0LV NwEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LYhIwXyVD/39oMR74zVRtfQwzlLh+xKdOpRyMjb1FEI=; b=fSH2GM79drJzgJo+oRHnNqCd6J/TEvh8XSC+sIVHWcgPKumsL8LsvHeCVOlY5F6i0m /F8XjOaWgVafyOVDGuHKD7TDujshJx3XJdNxJxl9M2Hr2tDe/c0GgB7uKMYoYSyQy7t5 jyfET8G65zTdRLg8bR+lZizMilwQUbi2+kvW8r71LI8Z5ULmsEGSDkJTDT7wFdiHQEJR jCWFXXW/JxENJsGIIA7H1a2jfppKy0gdganl6rYhPDBsaUhAPmmvBssCN13Ow+xHf9r4 5aaHtV620vuAPnWud+qogNJNPUTqwa4MKLeUY6FYR+hxlIZioBrr9pyVYTOFlmQYa1V9 OUoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1MRL7A8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm18-20020a056a00339200b00528999fe013si13085506pfb.290.2022.08.01.06.17.09; Mon, 01 Aug 2022 06:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1MRL7A8D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233478AbiHAMIj (ORCPT + 99 others); Mon, 1 Aug 2022 08:08:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233704AbiHAMIM (ORCPT ); Mon, 1 Aug 2022 08:08:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFF6F6554D; Mon, 1 Aug 2022 04:55:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 175E3B80EAC; Mon, 1 Aug 2022 11:55:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66647C433D6; Mon, 1 Aug 2022 11:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354939; bh=x+kigi7rCL6sNSqk2rscGr1xJcwUdCGThWCHSNNxY44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1MRL7A8Db6mtQZ5UyXd6g9DYPnRHX4hpapqHSnVuJNrLKRuw0l5jxhJRjB4RZBIDR 5G5Jh8cZGnrv0OvpojA9lH1ueJnM72/0zzbZEMuww5JAasRnSshQgb8rIp3GY+99CR UamSiYuIY36Qn5W5IdoD5R0h5uNsQdwF7RxAihYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 47/69] tcp: Fix data-races around sk_pacing_rate. Date: Mon, 1 Aug 2022 13:47:11 +0200 Message-Id: <20220801114136.378943057@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114134.468284027@linuxfoundation.org> References: <20220801114134.468284027@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuniyuki Iwashima [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 018be3f346e6..566745f527fe 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -902,9 +902,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