Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6267197rwb; Tue, 9 Aug 2022 12:04:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XsFj49YnaaGaYzynjD4fTiB71BhYVwNZ13b4/U3t5wa8FhzIuqt4v/8xdKpZlZ+DOB3dL X-Received: by 2002:a63:5664:0:b0:41d:10ae:a337 with SMTP id g36-20020a635664000000b0041d10aea337mr16787581pgm.58.1660071890629; Tue, 09 Aug 2022 12:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660071890; cv=none; d=google.com; s=arc-20160816; b=gGDEpIv/1m3hOXFFzuRLJnTxNpVxC6+VFFS7wl54JdW0hFTztvtIBIWjqeEbUOesVt +X2x2ov7G0RZu2J0Vt6xsgTX4AHq4v1+XPrWIWvpaPEZVQOR6+2/R/L9+cte5txwYIn/ gQV4EuTUNQKLSU/7Z00huVj3W5Gk+wabaqtZgS5dyEd9YvxGVbEezW81k/r+F+yTzAT9 HX7QXXWljIvOL1A4xUJNedJEXgvvml06Ct08InCu62m2C6NTU+LLBdMlhCOEHt16kYBX yLkqM7D7o1FnvwARcYiiP4Dzws7zTCH3KoEap4pZtEJQY0S7puFVPSUp5Mm0xHBjsmjA XzAw== 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=oosUA/kuO8AkDd3026U6nPj9TB/pl0+vwzEvmfjgc7Q=; b=eUjmIBNUmomPu6iKniy+jfCxGSdOf8SdlX67QRPBLPFrMWV/NvTHr3MAval1ospzda L6yN4L6Dr0KAAWVSNqScuU/5jnMU/qpXG7nVuzbYvEku5cGaYA+539u6mxI6YlqxKyMZ 4vAuAJHu2ZqJDNmhf/H+QdbX6+0YUrJ9b323JSwxep8iNiw+1TPo6IH8dRHnANbgC/8B gknQRTEN6F9js7hIXEV0+NMyIqpixw0uKiITNR7wRio7AaBbRqymNdMQ70BYg/eaMHIK 2mTBQpa77xcWj4nBBK7GDVFlMtku6AR8F9SvVFbv1vohP5CAE3ynm21b8VIY/ingHKLn +DdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=saN8XzFC; 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 e16-20020a170902ef5000b0016d3d79d5b2si14619562plx.305.2022.08.09.12.04.25; Tue, 09 Aug 2022 12:04:50 -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=saN8XzFC; 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 S1343495AbiHISFd (ORCPT + 99 others); Tue, 9 Aug 2022 14:05:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344635AbiHISET (ORCPT ); Tue, 9 Aug 2022 14:04:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A41327B23; Tue, 9 Aug 2022 11:02:20 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 91FF461058; Tue, 9 Aug 2022 18:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D23FC4347C; Tue, 9 Aug 2022 18:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660068139; bh=JJLoWX/i+PM0oYkcJDxKEqZrwJsz3Tar8k6vyE7PVb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saN8XzFCcJFS5QofSb5LJXqmeRSwVrXMe30V1p/qy8pupaPI3JDneI9jDKodbWJZh czHZVQGhKdMpwWp59DuW433zQ5ZT+a/mdj22t2h4Vu+yxg1azbBA6BPJ7gSbav9Y27 XK9vcVPMGSAKJ9kDxGgKPDUl8QgqYLnEYkgX5kGA= 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 4.19 15/32] tcp: Fix a data-race around sysctl_tcp_min_rtt_wlen. Date: Tue, 9 Aug 2022 20:00:06 +0200 Message-Id: <20220809175513.572561739@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809175513.082573955@linuxfoundation.org> References: <20220809175513.082573955@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,T_SCC_BODY_TEXT_LINE 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 1330ffacd05fc9ac4159d19286ce119e22450ed2 ] While reading sysctl_tcp_min_rtt_wlen, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: f672258391b4 ("tcp: track min RTT using windowed min-filter") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index f2dac14caeb3..04788bd5e82c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2903,7 +2903,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, static void tcp_update_rtt_min(struct sock *sk, u32 rtt_us, const int flag) { - u32 wlen = sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen * HZ; + u32 wlen = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_rtt_wlen) * HZ; struct tcp_sock *tp = tcp_sk(sk); if ((flag & FLAG_ACK_MAYBE_DELAYED) && rtt_us > tcp_min_rtt(tp)) { -- 2.35.1