Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4446316imw; Tue, 19 Jul 2022 06:48:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uOBHcqPcfkdwwnny4bF6H6ZiZM0JhKE3V1DzdayG1Z8mIDyKylpP61BtROn0uSyNK5u+Df X-Received: by 2002:a17:906:84e1:b0:72b:b109:7636 with SMTP id zp1-20020a17090684e100b0072bb1097636mr31324963ejb.10.1658238536868; Tue, 19 Jul 2022 06:48:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238536; cv=none; d=google.com; s=arc-20160816; b=Qfkp4KbzJoeIQCs4WpMUcN4N037/LlGnXYZ36jIR91RO3rle1NrablkVHec62MaQ2V zD9a73h0Ii0TUz4doYOi2UukhOSTMdclFec3H++6nX0fREAGcQ7ZsKj8h1RSCeqOzF7G CNEbEwH4Mm7cVDa5kAkrzx5/x/EbPh3qqUfCyDIAt/YtCz2F3KM+k1rVLEi/Hm7o21um vqVvNF/qzBjfn0bCX7hCLNvH25heQloWWYsgbXwpa04zLlkZ7LknPj6vHQ88YJrCqUQT k7/2/4Go/N7kl9ykeGKBvp6iqJimGzSXYK1RczV1R3lSTEIcfAJEiy+tPdD23AaVvIPc TekA== 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=HPePosqO+kqUspU8lxVDldsevLzkwWjuY4vqmsP3cHg=; b=rDOw6RKzqAiDANeqf2hkMzxa+cp4/41GSPs9LSx0e/woxe/wL16Aqse35qOACQxIhe aMY9ToOwdgkvrNvC8H3j7oAlgLQXNmEglXLMzFvw3JXH7L2D49KXCaTgcxelVtTw/JER r6hHIzQWcc4GvDYS05ZnprAxcdtgGCAMRdaZS914VdNHQUSBvx/Kr9FEbpFrYr3nL24d 2PYGvvMhYBNaWUBz9O6oMG+W6rh3yTCfAnIV4WjRVb+69KHVf8Jp47Gds87pg1QaxImX 7ifHV6+C1BIPeqDnXnNvt/96X2aPXRM6H9imdI/6VG2x5N+M1lEDGNnqWyAw+aZzJjyx cI4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ln5qcJl6; 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 w4-20020a50d784000000b0043abd7a1ba6si19894613edi.618.2022.07.19.06.48.32; Tue, 19 Jul 2022 06:48:56 -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=ln5qcJl6; 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 S241322AbiGSMkv (ORCPT + 99 others); Tue, 19 Jul 2022 08:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241115AbiGSMiz (ORCPT ); Tue, 19 Jul 2022 08:38:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9916129C87; Tue, 19 Jul 2022 05:15:26 -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 2798F61632; Tue, 19 Jul 2022 12:15:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC670C341C6; Tue, 19 Jul 2022 12:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658232925; bh=ZJSJzrQ/ud2KmT0rXxvBr/bjJ9OiqqmYvcpZppMlgZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ln5qcJl6xbswf32afhJHoiwk+kJrKVUka0xwfoiFud/b3MU7AEqz14TbLt51PNWa1 0eXKvMHUxw4mAiuQLl3YcURDZssK8kGdr/ZtGR1PGVlblYflbb1RlMTvFpqoUnWUYH kN8ShHt3wZL8WqudDKvsUVZHXtg0xIF3eQupKWNs= 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 090/167] tcp: Fix a data-race around sysctl_tcp_ecn_fallback. Date: Tue, 19 Jul 2022 13:53:42 +0200 Message-Id: <20220719114705.231101817@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220719114656.750574879@linuxfoundation.org> References: <20220719114656.750574879@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 49a8167dda87..616658e7c796 100644 --- a/net/ipv4/sysctl_net_ipv4.c +++ b/net/ipv4/sysctl_net_ipv4.c @@ -696,6 +696,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 dc3b4668fcde..509aab1b7ac9 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