Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp480144imn; Wed, 27 Jul 2022 11:22:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vWrMsq6iutjp0yysOLNkKEA1+0ve6yK5QvyLN2FMpHIt916oHhmCbljhyoPH83zBeyEc2R X-Received: by 2002:a17:902:f608:b0:16d:c44:137 with SMTP id n8-20020a170902f60800b0016d0c440137mr22963386plg.173.1658946135414; Wed, 27 Jul 2022 11:22:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946135; cv=none; d=google.com; s=arc-20160816; b=S4oHpSQALT2w1yvi4mXojlnCotiWQMHueg5pYeMZKBPvXrpXzzvd/46g8ZD44SEomG vp/HvZd1GC2d7KSF6K23crpREzJgg9ceMkyAmPrLAUw1ANmope/IkiHxjoCNnwRRwawU JZVSQTol+pbyfSZbJN2/r9YsS4qNhfE30aUWYWsDWUZAxfpUONioddveHFLgSHXkqEb1 JCTogEthuiw9qyWW15TlauZgwArWK+Vvj5WpeA4T0r47gAu6gJEtud9Oe73J7E3hUABq 9bgRSY+v4xgb76pXSLnDuXIX7Hh+qHnI3RZrU1p1AuGgLmPK5i+wL6pwHlT40pqPZQO7 ro+Q== 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=9B0ky2MzdfA+NQLX22Cmc23s3icGdcxnSx7avrI6g68=; b=P2PZfwv3vgQ6THxckxrGeZY8d36mS9sCGyDFilcyMdquExgZ+x8rY/HSrLwseqqUfZ eLDCTt1U5abdRN7AZsi9VnvStz5lveCCed1PbXAPdZRB6unqLQ3jyf2f9toG323dOt49 1q/D9iBQy20+kVg6OGnS9SLTliKfCRwTEe6wZQ09JWfjmzsOQ2sCpJuwAU/fAfMIutRk hok6ysmA5yjIVKvy9b8MGTBgEbdKItw9DaGKb48tbhZpma0DruW7I+WaPlcKT/MnUXXl t9qJYXJUPLh18lFme30PmtlKzfr/Ye4d92dl+/vkO8bi2EDhG6F92QA3LQtTXuW32Ou0 PRLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jc6LmH8Z; 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 my17-20020a17090b4c9100b001f248fefb0bsi3316612pjb.47.2022.07.27.11.21.59; Wed, 27 Jul 2022 11:22:15 -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=jc6LmH8Z; 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 S236941AbiG0Qcc (ORCPT + 99 others); Wed, 27 Jul 2022 12:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237705AbiG0QcA (ORCPT ); Wed, 27 Jul 2022 12:32:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 198A952FCD; Wed, 27 Jul 2022 09:25:59 -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 sin.source.kernel.org (Postfix) with ESMTPS id DFC02CE2303; Wed, 27 Jul 2022 16:24:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEDC8C433D7; Wed, 27 Jul 2022 16:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939094; bh=1HcNia9FqHE2hkx0BFQITQ6ChPd0Zwd2QPUi9++C3qg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jc6LmH8ZIxC4/IxhFnCC3wNvNSrq7dU3pRwRlTZ8LzcOWBXXcSJ2vMNlE5AZGBRxA B+zIny/NWxaVKATlXMIvXZM+hRz483UYtJvcGNu70vsumqc+7627TNLlXfwLReRGL0 uFF6Jt4BUKqtKDodcLU3VJDS9lZ7egQo7dU4UCY8= 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 11/62] tcp: Fix data-races around sysctl_tcp_mtu_probing. Date: Wed, 27 Jul 2022 18:10:20 +0200 Message-Id: <20220727161004.610623579@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161004.175638564@linuxfoundation.org> References: <20220727161004.175638564@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 25dbdb27a571..02a7799c4b72 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1523,7 +1523,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 d071ed6b8b9a..5d761333ffc4 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c @@ -144,7 +144,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