Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1943992imn; Mon, 1 Aug 2022 05:56:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CTaAqzzAaPlKEw1N/ZNsG4msjOCLwL46DRQY2hjBXm7LWiCJa/GeMGlePYwXjbP4RrooX X-Received: by 2002:a05:6402:3485:b0:43d:7fe0:74d1 with SMTP id v5-20020a056402348500b0043d7fe074d1mr7233246edc.413.1659358568670; Mon, 01 Aug 2022 05:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358568; cv=none; d=google.com; s=arc-20160816; b=OICuR+3erxstToIv0mWZdUM5NFcgaMRFt0gIpNjxfwvH0QbImzCLz1VSRxxgii2/Sj Kf3UvItYuadVCF9IMwIBwS1o5tXhkSIPZj3d3hw9INDBKOAVPasIdvayz+AOI/3rgTIU gHl7vEH6t0vUWMYQ9Pp/odE/PgRiz6E+JfDxz4sj3Xp6voGKuaViqJZP95nbLtAo5Kui VG6kAsfunD5uKkBZH7qFqZ+OQqaswiAT6reeXCUUpM7J1PQyHP/QuGLKC6wOt5Zg64cq do3dhYDjCOY/Ig9CW9CsfH2MB//wxUDNgFIhZXdTGdnvr2u7TDR5Yg40bFHDQ/IeEeoi Pn2w== 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=WxjK9WUBrIQe2G+SuhilGhXRZLsqjMfBNbQyCwDXF0g=; b=UJ3HaFuQu4SDDngPlColD9KkAfZRQlg0mm5i2Lbi5EuoaPYMKj4yEeDIZerd9KrWcL u0FknXWN16WhvSSx0kQijC758gyU/QxDRKT0Y4h9U0oxP6Je2Kkhw5rVgeW4Jdxadied hTCSoSGFpEv6wkAqI+odGmPMQ8b55DZRph1So5MSGwPWmTz6l7xzeEnDVrZXIW0ZAX1Q DJ1fqNzn1poJBEt7238BLO41b1OqC/5WxeA1KIhZvRE3wazxCZahQ/TDvuCJVqp8ro0p +JXVeZ9eAxJifSMcL1XOq3+o3OHazsvQvoO43Q7akhTiRt1vZ4uNrWyNlvbPYfaj8wAy /h9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xxspm+ou; 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 hz5-20020a1709072ce500b00730870cb4b6si2459592ejc.621.2022.08.01.05.55.42; Mon, 01 Aug 2022 05:56:08 -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=xxspm+ou; 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 S232197AbiHALxh (ORCPT + 99 others); Mon, 1 Aug 2022 07:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232038AbiHALxB (ORCPT ); Mon, 1 Aug 2022 07:53:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C194843E57; Mon, 1 Aug 2022 04:50:07 -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 4F6D2B81163; Mon, 1 Aug 2022 11:50:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF9A8C433C1; Mon, 1 Aug 2022 11:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354605; bh=K0CASPXfYFvHUtrCPMZiq0XFMgsCO1fnzPBCs9cEBKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xxspm+oucdoNXYAYQCBwQ2cy/g2j/ydo42Yw8IxbmiqSKg4ByO9FXm6nfHboumFk+ YlVruivg5zFvK2tKN0bgjWx6UrIYJspdEuOur8vylfGPntXNHyrIAYQjRpsLa1WTeM jW43uvaWArVrD8b9KcRAG6mCtQ3m+spWVUvlnPEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuniyuki Iwashima , "David S. Miller" Subject: [PATCH 5.10 20/65] tcp: Fix a data-race around sysctl_tcp_challenge_ack_limit. Date: Mon, 1 Aug 2022 13:46:37 +0200 Message-Id: <20220801114134.544580903@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220801114133.641770326@linuxfoundation.org> References: <20220801114133.641770326@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 commit db3815a2fa691da145cfbe834584f31ad75df9ff upstream. While reading sysctl_tcp_challenge_ack_limit, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 282f23c6ee34 ("tcp: implement RFC 5961 3.2") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3576,7 +3576,7 @@ static void tcp_send_challenge_ack(struc /* Then check host-wide RFC 5961 rate limit. */ now = jiffies / HZ; if (now != challenge_timestamp) { - u32 ack_limit = net->ipv4.sysctl_tcp_challenge_ack_limit; + u32 ack_limit = READ_ONCE(net->ipv4.sysctl_tcp_challenge_ack_limit); u32 half = (ack_limit + 1) >> 1; challenge_timestamp = now;