Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4453667imw; Tue, 19 Jul 2022 06:57:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sff3jZR+Ycj79Xf9NuydnXLZpdQpk12AlPfynzy0OfRrCi2lXhCVJEAQTSYkosKGJ5SOWd X-Received: by 2002:a17:907:6e13:b0:72b:509e:bd6b with SMTP id sd19-20020a1709076e1300b0072b509ebd6bmr30747197ejc.202.1658239064151; Tue, 19 Jul 2022 06:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658239064; cv=none; d=google.com; s=arc-20160816; b=IGOuMeraa3KS4+jglzI3b7yUo0JZpXQy7NqW1OKAWbHB010B7fVczqyx7y4gTMn31q XWBO3LgGSaYboIr+VJbFezVDtEISCftiKDszuG2LeMisgLTjg9ZRqWk/U8wQ8/UrhsXz e/DihiKarM9E67P5Or0qSzCgPDC+pRBjS9BGOuW5bY/3jwGsS/n5d21GysVUhhGn1SDp tN5/115n0ECBCXJ0ca8HXKLBLwW3KXiDdEdKVEOS4kory15H4SwOZ53/Ue6x8u22jFNr MfYBYEbDm7tBgf7A96KuShXASFx1t01mYrf/6pGs6l2oUFxNbOVU/0qZWurq/kbPyp4U 4ITw== 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=aag8c/M01YaDCx9BsST7wDJsPtBVrG1rlnayZXfIGAw=; b=ou2qSksifH2kXlHRswFDxoLgqfNgEZ6FwVbFeGwjvSxXVLuXAX3P6hL2W2w66nQkGC MPnvNxs0Wch/WMmwIFK3y2c1qLUWNRH0xNEEgqBYv3WhFQ54a+1QAK18ACiwykS0xgwD EU0mugW23hPdgWIA9R3dfnZ8sOvd+o4/2nwfgPNxPC4Pxl0EFN3IBsI/4CDG8W/Hi3l0 wPMrXtQHwjfQ/Q9hsGL0QgQuGGFClTrnDUOlCKK5WszqiCud2XRU9DblecbkU8becjaa ReUuW8KAa+D/iIl4ZsMU/LebOKXEI92glbVdnc2FXEyCgD+Ui0PHE4gfLKoyhOKNf0xg z4WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y5JddwXX; 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 r12-20020aa7da0c000000b0043a94332d14si15890836eds.320.2022.07.19.06.57.18; Tue, 19 Jul 2022 06:57:44 -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=Y5JddwXX; 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 S242583AbiGSNCg (ORCPT + 99 others); Tue, 19 Jul 2022 09:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242919AbiGSM7t (ORCPT ); Tue, 19 Jul 2022 08:59:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA4E4BD06; Tue, 19 Jul 2022 05:25:18 -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 13D58B81B82; Tue, 19 Jul 2022 12:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF8DC341C6; Tue, 19 Jul 2022 12:25:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658233515; bh=LNbB8tIV6AgkH04KAZ85y76xz1DHDWBXK4uA1vgSrE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y5JddwXX3gNtKscOAmEMCC2B3eg/AysmDtjAhOd66koG5S1rB3b0p+5SslRWpZ1lQ mrSImOgMxDAwndMQ++2kOIDb87zQlf6Yyib+izIAxnwXW5lakDoUsb5TEmM2DmF6sO eXsneFcFXfv/lF8cgwn1ksgv0GXa6wuCiEcJojIk= 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.18 121/231] tcp: Fix a data-race around sysctl_tcp_ecn_fallback. Date: Tue, 19 Jul 2022 13:53:26 +0200 Message-Id: <20220719114724.628158175@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114714.247441733@linuxfoundation.org> References: <20220719114714.247441733@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.8 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 12b8d9ca7e678abc48195294494f1815b555d658 ] While reading sysctl_tcp_ecn_fallback, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 492135557dc0 ("tcp: add rfc3168, section 6.1.1.1. fallback") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/sysctl_net_ipv4.c | 2 ++ net/ipv4/tcp_output.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c index 11add5214713..ffe0264a51b8 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -689,6 +689,8 @@ static struct ctl_table ipv4_net_table[] = { .maxlen = sizeof(u8), .mode = 0644, .proc_handler = proc_dou8vec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_ONE, }, { .procname = "ip_dynaddr", diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 9eefe7f6370f..34249469e361 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -346,7 +346,7 @@ static void tcp_ecn_send_syn(struct sock *sk, struct sk_buff *skb) static void tcp_ecn_clear_syn(struct sock *sk, struct sk_buff *skb) { - if (sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback) + if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_ecn_fallback)) /* tp->ecn_flags are cleared at a later point in time when * SYN ACK is ultimatively being received. */ -- 2.35.1