Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6268041rwb; Tue, 9 Aug 2022 12:05:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5VDp/tgoSfUngMAaE8IOdlUBR+Gxjtz6KS6g5omnrPL9Lan/rwDdVMWC0/o3xAOPPTxEsT X-Received: by 2002:a17:907:3f8c:b0:731:dacb:436d with SMTP id hr12-20020a1709073f8c00b00731dacb436dmr3615738ejc.438.1660071933011; Tue, 09 Aug 2022 12:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660071933; cv=none; d=google.com; s=arc-20160816; b=WVyMDPQ95TPDGGCYmkTRmyiq0DO6dIpDGF0lA6ySRs8ft9xnqYwM6/5VZcpl8YFC4u wqs4RqSPIg2MZjzf17pcfR6WxonOYqV3+y8rVLZfuATYbwfm2UsNBwYbJnoNp162FOsL SI1ehmLLkPI87JutVDanjg3QAJ1Cq0zW34ZDA7dOcEc7fMobzdjeUAkiOqkFfM+JxZ2y gVywOfnCVS0cLwY7O0IOx/H0VIIodaiZvGuNftzZi/0jQ6rcyDo8yFj32cHfp3a8W5X7 LKr41cSBPM0OJwyG1XueJQ6Uy5O8nLwb79ozW22g7fprShRJZtenfZHJeLfzcPiR6c5S kTTQ== 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=6wDoiL86q8a7Cd5ADezTlmzNutCNig7ShDs094LimfI=; b=mvBy2a+h1Sq/XFyxhWsLAudOcTVKXWZ0wgUUNSEciZb1I7zneBf6pDShMS4SWklzdq XugQ8ZJ99cZnl1nnr3M32/vEvczFBij1NLmovzA1lC3tZzqHObNgtXyAWW3HGgHEmkm9 dQnVbIhnUT4yaYjgBb0nIbp3vDUp+6XUUgYH+0Ia3dj8LfwaE1mCIWwv0kEnHCrWcGK6 Edu2vXapKgUXLnKC45mV9tRHdzCcRzoTfycdcHTqZC50KTDP0sUlre+goP97XPlV5w7F ESDgoObT8BZs5ujYhAhLRXbngWFMQ6ZyDGAVIrPkLvYZXDUzEeMemtV6q2DOxHqaQfQ7 lRZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qrdry0DG; 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 l20-20020a056402255400b0043e82c5ef90si9934733edb.367.2022.08.09.12.04.55; Tue, 09 Aug 2022 12:05:32 -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=qrdry0DG; 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 S245723AbiHISD7 (ORCPT + 99 others); Tue, 9 Aug 2022 14:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344428AbiHISC5 (ORCPT ); Tue, 9 Aug 2022 14:02:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F295E2717C; Tue, 9 Aug 2022 11:01:42 -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 9144061032; Tue, 9 Aug 2022 18:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CFC5C433B5; Tue, 9 Aug 2022 18:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660068102; bh=FFrz7DX6Q17sKODRW878j2Iuw3+7Vmfe99AmsiCyBU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qrdry0DG0FVJz0ddP4NBNyNIqq4c/xH6fdD9Rhvc9hoEDaPTfspUIAKWv64ai+xbw vxM9JUX68GqrM9nKGzfGa2Er5QhG8XnNS6LNaLUims8Agpsl2vxbEshVlbtSeREqJw wB5RjllEj+/jWVlfsYlpdU/QGz067P7bP1tYJd+8= 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 4.19 05/32] tcp: Fix a data-race around sysctl_tcp_app_win. Date: Tue, 9 Aug 2022 19:59:56 +0200 Message-Id: <20220809175513.262403233@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220809175513.082573955@linuxfoundation.org> References: <20220809175513.082573955@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,T_SCC_BODY_TEXT_LINE 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 02ca527ac5581cf56749db9fd03d854e842253dd upstream. While reading sysctl_tcp_app_win, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") 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 @@ -432,7 +432,7 @@ static void tcp_grow_window(struct sock */ void tcp_init_buffer_space(struct sock *sk) { - int tcp_app_win = sock_net(sk)->ipv4.sysctl_tcp_app_win; + int tcp_app_win = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_app_win); struct tcp_sock *tp = tcp_sk(sk); int maxwin;