Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1957524imn; Mon, 1 Aug 2022 06:17:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR4hCjRlKPoLLeslb6lk4WByfHnZ0T7gOY7sp9p7mbVmKlasxiHOi1WJlDmg4LqKcEuV43QT X-Received: by 2002:a17:90a:d789:b0:1f5:1c76:24d6 with SMTP id z9-20020a17090ad78900b001f51c7624d6mr30526pju.188.1659359853325; Mon, 01 Aug 2022 06:17:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659359853; cv=none; d=google.com; s=arc-20160816; b=grP2XXsOzGd/j+i7h0fMZbplGkWsxeZyFjJO03jrw0KJL4PsznsaNYwgq41sbD+ldq sILa1kYSkE1DM1KFsGpOzCHxc2npIJkBtfKTsHoh3M/i7zHS7Vyq+xjeMtNycmV1c5hT BJFKIbQftXRF5jP50hk508STok0NSJblx3boNdsOagvPKB/5Jt4hgpoV6AMDG0L226VV sxUZshHBvVRmDk0jsrv6WFucyp2Un1TndQv2xnhRytmBMhxOEgdaaE+cnxPD/VNb7Z/O 0Xjgqhw2NuTeYv7u3MWJ54D8TryUGyRhKCxzApcs3fETZMM+9H0TGNBKX122fuvEWl3e 9Cyw== 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=ZT1lWNRwz4xZ3GJhJi9dxwzxIyifgmpo9gZr2EdvZbU=; b=TfmyD7qa2iiDSChxCFNwjVQr2F5H4PKuudcNgB4DGT3B54x42njpOn9U2RAMRvCnuw aok5NW113Lud84jKYUmfs62ouEjrse7WqZTemZ1YBqGFI/6wU1xRHJ93icxIQ7nb0xT+ PxR/0HdSj5ce3K/9yd4GU+BuX6MHjNv6WnN0fbLPDZ1HJClp/cLg/cJdhjBMp698Z8FQ YvnSDi/6DHEaeslt37ZGy1nQUB08BTBxsvkYEAN9Fh1QDYkpiW2p8UTRBxNLI3nlM715 5mSzvTVGHtBNMWY2Iivn+JWNKspKUVlrIzrqGS+1fg5nu2wXOmEARVMG5AsFxIeJBRXo Lh5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h+sg5zCV; 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 v11-20020a63d54b000000b00408c2ac7412si10845960pgi.660.2022.08.01.06.17.18; Mon, 01 Aug 2022 06:17:33 -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=h+sg5zCV; 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 S232086AbiHALyU (ORCPT + 99 others); Mon, 1 Aug 2022 07:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbiHALxf (ORCPT ); Mon, 1 Aug 2022 07:53:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A84629CBF; Mon, 1 Aug 2022 04:50:24 -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 3E808B8116E; Mon, 1 Aug 2022 11:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84644C433D6; Mon, 1 Aug 2022 11:50:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354621; bh=JldWJW3ntF3SZTyasCpQWeWDzCX/AG7rGZgkZ/Q4Y9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h+sg5zCVn6OGsixL90gXDlv+i9Kz3U50hN9m5vKN9gsIwT73spy6rXz29k11E/A5x I+O0Q+QcJva5KfAyYC1fUrygAHNvnK2goy0Es5bM7TfUiI2qXnjfTV5w0VPhzskXcW MijvBNbl4/aMGPFsxBj5hBnGiOQ8G++B8uY1eSV0= 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 26/65] tcp: Fix a data-race around sysctl_tcp_min_tso_segs. Date: Mon, 1 Aug 2022 13:46:43 +0200 Message-Id: <20220801114134.804266707@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 [ Upstream commit e0bb4ab9dfddd872622239f49fb2bd403b70853b ] While reading sysctl_tcp_min_tso_segs, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 95bd09eb2750 ("tcp: TSO packets automatic sizing") Signed-off-by: Kuniyuki Iwashima Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 1a144c38039c..657b0a4d9359 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1984,7 +1984,7 @@ static u32 tcp_tso_segs(struct sock *sk, unsigned int mss_now) min_tso = ca_ops->min_tso_segs ? ca_ops->min_tso_segs(sk) : - sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs; + READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_min_tso_segs); tso_segs = tcp_tso_autosize(sk, mss_now, min_tso); return min_t(u32, tso_segs, sk->sk_gso_max_segs); -- 2.35.1