Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1943527imn; Mon, 1 Aug 2022 05:55:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uc32RU4ScEylCTO1fCKjGdbn5kMKNXIpG5Z826xusmas1bBS7QBf0Tl1G9pn+/Ib5PbtFX X-Received: by 2002:aa7:c1d0:0:b0:43c:f89f:a134 with SMTP id d16-20020aa7c1d0000000b0043cf89fa134mr15261470edp.4.1659358514711; Mon, 01 Aug 2022 05:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659358514; cv=none; d=google.com; s=arc-20160816; b=amuC7RzhGCGuwOXveOqLwQzSJMe4+5bP1sdaFa1Mp/lc2ZnpVuGx2XEOwzXCVJ3sNS P5Lh3HV8Rq9O5g3ADGwxbDPuhbyvxTU872v0eybhNS6rOL0jxJwRs0xESOMPJTxWH2Lb r/qaRSYwLWNn3q+C2bQlWRCfQvtC8+Y7cmtI6583W4wd2hBcEj5STmDNP8reWghqgFaj GY9qMBjzyWTU/kKk6CBNgz796YeVucBCqS2tGtzYTAQmWN4n+xa3sc3XVfxOaXMwbzow WIuVqpuTLAdBkTtUIg3I/r+QFCpmDNBRwXdBH++vw/zPBqHf74Tw2BEqvbFbX0I/IFN7 K7Iw== 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=qAYtrMJuNYNHVgewD8lhNg5Q9f1L6JEDg7N29iuypBE=; b=wOEeZBhD7iSSVmZze/jmutvmH+7/2e5w/hSfePYU1roDhZyJwxcHioKmas1chj7CJU oLTr2l+6hrIy4utahFXWZreujRhqbhzoj3R391h2ywdmynHI4PHqJkLKxdoilB01CzVs ISJUQJA/vxHrCRR/v/45tRxxqaJ5C+qrFYcglWYLxiXN4WvvX77IhIZa4RGuQrKs61cn ar1bQVGlwL7GcaqYHoa5r/RyQ5i3L1AwS4CfzonXVcKYHr96n8Yd7mG4laMyIGFYBEse if3F0znEu04CllAgyiFzqjlXmp0Vijoqo6ycfAEGFKrkv3otOrCWRdyfpCoYQ9aiwiQ/ iJjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mp8MGZ6L; 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 j11-20020a05640211cb00b0043c158735ddsi11800047edw.109.2022.08.01.05.54.49; Mon, 01 Aug 2022 05:55:14 -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=Mp8MGZ6L; 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 S232486AbiHALz0 (ORCPT + 99 others); Mon, 1 Aug 2022 07:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232356AbiHALyi (ORCPT ); Mon, 1 Aug 2022 07:54:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF70D3CBE4; Mon, 1 Aug 2022 04:50:52 -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 6C8AE6125A; Mon, 1 Aug 2022 11:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A653C433C1; Mon, 1 Aug 2022 11:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1659354651; bh=0fxKXtD5VUAoJzS3L5pj9ecR5pb2Z9NXHQ3EPGgtdMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mp8MGZ6Lzi8Aki5w052qa9c7d3f6msrK+e9KRY7phXDRCgE3jqSm5dmphxTAkYM/r MtRMzemIlctX0xdbWbbsVFei2WINUHwjXwbcgadXBCbVlyXK0TOGVGEv15e9jWWBNK Ye8m+mP0oSd9vwLSwU67IVZiE+Wm7/8XKBaWkfSA= 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 09/65] tcp: Fix a data-race around sysctl_tcp_app_win. Date: Mon, 1 Aug 2022 13:46:26 +0200 Message-Id: <20220801114134.074850891@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 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 @@ -503,7 +503,7 @@ static void tcp_grow_window(struct sock */ static 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;