Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp480002imn; Wed, 27 Jul 2022 11:22:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ukdhudCRV9tUwny6MnSB/PxBB39jx0lLeKCj6NlQS2kjq6RSi0C3tvVSxyC8XR/op6CWCo X-Received: by 2002:a17:907:3f13:b0:72f:2235:2c92 with SMTP id hq19-20020a1709073f1300b0072f22352c92mr18466477ejc.219.1658946123474; Wed, 27 Jul 2022 11:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946123; cv=none; d=google.com; s=arc-20160816; b=VzF0YXZIxUmSDwUJghyJWRGw5ofQHKFGIiaha9z/qjKGHZN1s6bGKY1de2xVOoioDX eftDDJ2zFiLg5bh0x2IbVkwAQ3LqZ55GDyRe2xpeoKf9mNjd4qV5nfnsHk+XxDEuKU6F +mPbRuyb5kZFckWQ8V/y+QmJy3LUW5yY4rgx33KDk8+1uBDBcyvi3BZkZkG5PQK2FFrl U9yKnCWPwMB0wGSpSEAmTX73rBlL6tmkfNxd1C7IRPWpabngkauShzmVMKa3RySfpg2m ODmDnW7qJ6ROz5AGwFklo3Cbcb29+ddRWA0Yj7cVa35PjLnKvzoN6IYqKeRtn3Y/Ie1o waPw== 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=JpVL9wu9EXJ6NHzLi2UyQk62NWYTRw5mKWZHGLOYYdc=; b=cNU4WlCO1YgaibzmLLnf/mm0C6PR6zPEiKCPInqudycR4TVDY1NZi9qKxcwTt97PkK 1bmw6VnUp3f6TnxaRqgxDOf+MJmrbuoSdTzQ60zZENohe75Z9AI/Yl2OVx8UbfUgrYPI Xyyg6C/DHREGbfYZvs7vkkY4dPY1TAjgxK/F/VR21enf4FDCpeEcJmm6P6c/x7eGgimF 2NOiX4S9AvwRdyifQnPKG78Xq/DxhYxrhTL75j71NAURSeLFk+U6a/rdDVQQu+mvdYFv 6oarXe9soca+L2NqMps9QjTl45b4vBU6mlXxQ0D05W15U8WStoGnQINGylstNHckKh3E 7JMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IAYOhX4a; 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 f20-20020a056402355400b0043bea1ef410si10975345edd.394.2022.07.27.11.21.38; Wed, 27 Jul 2022 11:22:03 -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=IAYOhX4a; 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 S240733AbiG0QvN (ORCPT + 99 others); Wed, 27 Jul 2022 12:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240678AbiG0Qum (ORCPT ); Wed, 27 Jul 2022 12:50:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5F553D3F; Wed, 27 Jul 2022 09:33:11 -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 66586619FF; Wed, 27 Jul 2022 16:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75DC4C433C1; Wed, 27 Jul 2022 16:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939589; bh=gYTHkNJ1nGb6DgzOYOdo49842e2t6x0sUyDmmCr/jtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IAYOhX4aH0rtMrpnn/gkI/0a7koHN4FY+/sGYHda6744C3SyEfacaeNCArUHNyZ7S Wqvqxc2qEOn0/4VC3MYJLiXTVz4FKwCuMvI+OINS6SdaPx5iKPd+o4y/7jHmjObugp q4VQDrhD+E26pfaKbCRO2yRf1jQrdw2ODkNVi/n8= 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.10 035/105] tcp: Fix data-races around sysctl_tcp_mtu_probing. Date: Wed, 27 Jul 2022 18:10:21 +0200 Message-Id: <20220727161013.504877123@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161012.056867467@linuxfoundation.org> References: <20220727161012.056867467@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 f47d00e077e7d61baf69e46dde3210c886360207 ] While reading sysctl_tcp_mtu_probing, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers. Fixes: 5d424d5a674f ("[TCP]: MTU probing") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_output.c | 2 +- net/ipv4/tcp_timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 8634a5c853f5..423ec09ad831 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1763,7 +1763,7 @@ void tcp_mtup_init(struct sock *sk) struct inet_connection_sock *icsk = inet_csk(sk); struct net *net = sock_net(sk); - icsk->icsk_mtup.enabled = net->ipv4.sysctl_tcp_mtu_probing > 1; + icsk->icsk_mtup.enabled = READ_ONCE(net->ipv4.sysctl_tcp_mtu_probing) > 1; icsk->icsk_mtup.search_high = tp->rx_opt.mss_clamp + sizeof(struct tcphdr) + icsk->icsk_af_ops->net_header_len; icsk->icsk_mtup.search_low = tcp_mss_to_mtu(sk, net->ipv4.sysctl_tcp_base_mss); diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 4ef08079ccfa..3c0d689cafac 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -163,7 +163,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) int mss; /* Black hole detection */ - if (!net->ipv4.sysctl_tcp_mtu_probing) + if (!READ_ONCE(net->ipv4.sysctl_tcp_mtu_probing)) return; if (!icsk->icsk_mtup.enabled) { -- 2.35.1